My heartfelt thanks for the update. I'll try and remember that the next time the question crops up.
Much agreed! I always knew tha .lib order mattered, but I would have never thought about the .o file as well. I rarely use GCC, but this info will come in handy the next time I do. Sneaky sneaky! I'll make me a little post-it note with that hint to remind myself [wink].
Quote:Original post by fireside Hm, my Linux makefiles do all have the -o listed first before the libraries.
It's not the -o but the *.cpp or *.o that matter. The -o option lets you set the name of the output file, and is best left at the end of the line (to avoid trashing some of your files if you accidentally omit the output file parameter).
"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." — Brian W. Kernighan
Thanks. I just figured that was the object files. That makes sense. Does it work the same if you use *.o? I've noticed some makefiles use that, some .cpp. Some both.
Quote:Original post by fireside Thanks. I just figured that was the object files. That makes sense. Does it work the same if you use *.o? I've noticed some makefiles use that, some .cpp. Some both.
.cpp (or .cc, or .c or .m or ...) files first compile to .o .o files are then linked together (and with libraries) to make an executable.
Without the -c option, gcc directly performs both operations.
It really depends on your build process.
"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." — Brian W. Kernighan