Re: [Dev-C++] [Help] Unable to link lots of object files
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Luigi S. <gi...@li...> - 2003-05-29 05:37:32
|
On Wed, May 28, 2003 at 01:36:56AM +0100, Tom Craig wrote:
> [...]
> my system refuses to link all of the project's object files.
> [...]
>
> Does anyone know of any way to circumvent this desperately frustrating
> problem? Is there, for example, a way to combine object files so I have
> fewer of them?
>
> [...]
>
> --Tom
Hello Tom,
you could try to add your object files to a (static) library
using the program Ar. I'm sure that you already know how it
works, however, for the sake of completeness, here is a simple example.
Assuming you wish to add the file "foo.o" to the not yet existing
library "libexample.a", type:
ar -qs libexample.a foo.o
('q' tells to append foo.o, 's' tells to make an index)
To list what is in the library, use
ar -t libexample.a
And you should see the sole "foo.o"
Now to append another file, say "bar.o", type:
ar -q libexample.a bar.o
('s' is no longer required, since an index exists, it will be
automatically updated).
Again, to see what's in the library, use
ar -t libexample.a
Finally, to make your executable:
gcc -o big_prj.exe main.o libexample.a
Regards
--
>> gisan >>
|