I want to take all of the C++ object files in a directory and ball them up into one object file.
I tried "g++ -r -o out.o in_1.o in_2.o ...", but I get the error message "/usr/bin/ld: cannot find -lgcc_s". What's up with that?
I want to take all of the C++ object files in a directory and ball them up into one object file.
I tried "g++ -r -o out.o in_1.o in_2.o ...", but I get the error message "/usr/bin/ld: cannot find -lgcc_s". What's up with that?
Ah, that works much better. Thanks! I used to use ar, but I decided I wanted to simplify my build procedure by having each subdirectory make one object file, and then combine those at the top level. Before, I had a directory full of libraries that had to be listed in exactly the right order to the loader.
The problem with using merged objects instead of libraries is that during library linking, ONLY the .o files (within the libraries) which contain functions that are ACTUALLY REFERENCED are linked. If you merge a bunch of .o files into a monolithic object, this ENTIRE object must either be linked, or not linked.
So if you want to use only one or two functions from such a "library," the linker is going to pull in EVERYTHING, including a bunch of dead code.
Not to mention that you might get name conflicts with internal-only functions. Or does the linker rename them on merging?
All the buzzt!
CornedBee
"There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
- Flon's Law
Yes, to a masochist. To us normal people it would just be a nightmare.
All the buzzt!
CornedBee
"There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
- Flon's Law