Quantcast
Channel: Active questions tagged gcc - Stack Overflow
Viewing all articles
Browse latest Browse all 22162

How to combine gcc flags -o and -MM correctly?

$
0
0

During compilation and linking of a simple program, I encountered a weird behavior of gcc that I cannot explain.

This here works perfectly fine for me

cc -Wall -c -o obj/main.o src/main.ccc -Wall -c -o obj/foo.o src/foo.ccc -Wall -o bin/program obj/main.o obj/foo.o

However, once I ask gcc to create and store dependency information in a separate file, the linker throws an error:

cc -MM -MP -MF deps/main.d -Wall -c -o obj/main.o src/main.ccc -MM -MP -MF deps/foo.d -Wall -c -o obj/foo.o src/foo.ccc -Wall -o bin/program obj/main.o obj/foo.o# obj/main.o: file not recognized: File truncated# collect2: error: ld returned 1 exit status

I expect gcc to write the dependency information in the file provided with the -MF statement. In seems that the object files are somehow modified such that the linker cannot read them anymore.

Any suggestions?


Viewing all articles
Browse latest Browse all 22162

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>