Author Topic: How can I add .lib or .o files in linking stage???  (Read 6768 times)

Offline Hgetis

  • Single posting newcomer
  • *
  • Posts: 2
How can I add .lib or .o files in linking stage???
« 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.
« Last Edit: May 02, 2010, 03:35:55 pm by Hgetis »

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7594
    • My Best Post
Re: How can I add .lib or .o files in linking stage???
« Reply #1 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.

C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline Hgetis

  • Single posting newcomer
  • *
  • Posts: 2
Re: How can I add .lib or .o files in linking stage???
« Reply #2 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..

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7594
    • My Best Post
Re: How can I add .lib or .o files in linking stage???
« Reply #3 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
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org