News:

As usual while waiting for the next release - don't forget to check the nightly builds in the forum.

Main Menu

adding object files to static lib project

Started by dfatcb, September 26, 2011, 08:24:59 PM

Previous topic - Next topic

dfatcb

code::blocks doesn't seem to add the .o files I add to a project to the resulting library .a file.  Is there anyway to make it do that?  I'm using Code::Blocks in Linux, all the other IDEs I used in DOS/Windows have always added any .obj files added to the project the the resulting .lib created.

TIA!!

oBFusCATed

What is the type of your project?
If this is not a static library then you won't get a lib (.a)!
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

dfatcb

it's a static lib.  I get the .a file for all the .c and .cpp source, just doesn't seem to know to add the .o files?

oBFusCATed

No .c or .cpp file is added to the .a files.
They are first compiled to .o files and the .o files are added to the lib (.a).
Is this step that is broken or do you have external .o files which you want to be added to the lib?
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

dfatcb

Yes, of course, external .o files added to the project that want to be added to the .a lib when built.

oBFusCATed

Have you tried to make the files link?

Right click on the file -> Properties -> Build -> Link file.

I don't know if this will help. If it doesn't you'll have to package the .o files yourself in a post build step.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

dfatcb

yeah, they were set like that by default.  I'll have to do the post build step.  do you happen to know the linux command to add an .o file to a .a file?

oBFusCATed

I guess "man ar" should tell you the correct parameters.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]