FlorinBr <[EMAIL PROTECTED]> writes: > I wonder if you can do the following: I have some object files ... > and I would like to "link" file1.o , file2.o , and file3.o into a big > object file, let's say file.o, but which shouldn't be an executable - > I want it to be just an object file, which is to be used in a > later(final) linking stage.
When asking a linking question, do tell what your OS is -- it's impossible to answer your question without knowing the OS. Assuming UNIX/Linux, yes, you can combine multiple objects into a single one: ld -r -o file.o file1.o file2.o file3.o or ld -Ur -o file.o file1.o file2.o file3.o >From "info ld": `-Ur' For anything other than C++ programs, this option is equivalent to `-r': it generates relocatable output--i.e., an output file that can in turn serve as input to `ld'. When linking C++ programs, `-Ur' _does_ resolve references to constructors, unlike `-r'. It does not work to use `-Ur' on files that were themselves linked with `-Ur'; once the constructor table has been built, it cannot be added to. Use `-Ur' only for the last partial link, and `-r' for the others. Also note, that combining multiple objects into single one may or may not be appropriate in your situation, but since you provided no clue *why* you want to do that, I can't give you any further advice. In the future, try to ask "I want to achieve X and I think I need to do Y to get there. How do I do Y or is there a better alternative to get to X?" Cheers, -- In order to understand recursion you must first understand recursion. Remove /-nsp/ for email. _______________________________________________ help-gplusplus mailing list help-gplusplus@gnu.org http://lists.gnu.org/mailman/listinfo/help-gplusplus