Code::Blocks Forums

User forums => Using Code::Blocks => Topic started by: Hgetis on May 02, 2010, 03:24:30 pm

Title: How can I add .lib or .o files in linking stage???
Post by: Hgetis on May 02, 2010, 03:24:30 pm
Greetings everybody.

I use C::B for a couple of months now and I am facing a problem while trying linking C object files.

I have built a project which compiles perfectly, BUT in the linking process I must add a library file (.lib) made for use with MS Visual Studio 2008. The same library file is provided as an object file (.o) for use with Linux GCC 4.3+. Both files (.lib and .o) are the same but each one compiled for use with Visual Studio 2008 or Linux GCC 4.3+.

Now my major problem is that I don't know how to add a file like these (.lib or .o) to my linking stage in C::B. I always get linking errros.
Furthermore I don't know if there is any support from C::B for this kind of library files (.lib and .o).

I really need some help here because all this is about a college project and available time is very very limited (about 2 days from now)..

PS. I have Code::Blocks installed both on Windows XP and Ubuntu 9.10 systems.
Title: Re: How can I add .lib or .o files in linking stage???
Post by: stahta01 on May 02, 2010, 04:19:55 pm
I suggest learning how to convert the .o into an .a library.


Add the library without extension to linker library list and see if it works.

Use Full Compile Logging to see what happens; read Wiki FAQ if you don't know how to turn on logging.

Tim S.

Title: Re: How can I add .lib or .o files in linking stage???
Post by: Hgetis on May 02, 2010, 06:58:40 pm
Thank you for the quick answer!

Is there any "how-to" convert the .o into an .a library? A quick search via google wasn't very helpful..
Title: Re: How can I add .lib or .o files in linking stage???
Post by: stahta01 on May 03, 2010, 03:41:00 am
Thank you for the quick answer!

Is there any "how-to" convert the .o into an .a library? A quick search via google wasn't very helpful..

Google worked for me; but, I did almost know the answer. "gcc library creation howto"

http://www.adp-gmbh.ch/cpp/gcc/create_lib.html