Author Topic: Add a specific Library  (Read 12341 times)

gl0be

  • Guest
Add a specific Library
« on: December 17, 2005, 06:24:35 pm »
Hello !

In my program, I have to use a specifique library named Battle.lib. So I add it to the Build Option -> Linker -> Link libraires and I use the correct file "battle.h" in my program but when it's linking I've got this error :

Code
C:\MinGW\bin\..\lib\gcc\mingw32\3.4.2\..\..\..\..\mingw32\bin\ld.exe: cannot find -lBattle.lib 

Do you know how I can resolve it ?

Thank you

gl0be

Offline killerbot

  • Administrator
  • Lives here!
  • *****
  • Posts: 5490
Re: Add a specific Library
« Reply #1 on: December 17, 2005, 06:26:12 pm »
did you specify the full path to the lib, or is the path added to the lib search dirs ??

gl0be

  • Guest
Re: Add a specific Library
« Reply #2 on: December 17, 2005, 07:46:30 pm »
i try to use the both methods but's the probleme is the same... :?

Offline Vampyre_Dark

  • Regular
  • ***
  • Posts: 255
  • Hello!
    • Somewhere Over The Rainbow...
Re: Add a specific Library
« Reply #3 on: December 17, 2005, 08:19:48 pm »
name it libBattle.a

And don't you have to use that program to go from lib -> a?
C::B Wishlist
~BOYCOTT THE EVIL YELLOW BOXES~

gl0be

  • Guest
Re: Add a specific Library
« Reply #4 on: December 17, 2005, 08:48:54 pm »
I dont't really understand your question, I'speak a little bit english only...

I tried to rename the battle.lib to battle.a but the error is always the same

cannot find -lBattle.a

any other ideas ??

thank you
« Last Edit: December 17, 2005, 09:09:26 pm by gl0be »

Offline Michael

  • Lives here!
  • ****
  • Posts: 1608
Re: Add a specific Library
« Reply #5 on: December 17, 2005, 10:26:55 pm »
I dont't really understand your question, I'speak a little bit english only...

I tried to rename the battle.lib to battle.a but the error is always the same

cannot find -lBattle.a

any other ideas ??

thank you

If C::B cannot find a library, a quick and dirty solution consists to put the absolute path of the library in:

Project->Build options->Directories->Linker

For absolute path, I mean:

if your library is in C:\programme\mydirectory\mylibrary, then add such path in the linker.

This has always worked for me (since C::B RC1) :).

You can also try to move the added path in the first position of list (if you have more than one path). This could be helpful for some libraries.

Vampyre_Dark asked you, if there is not a tool that convert a .lib to a .a library (Vampyre_Dark please feel free to correct me if I have misunderstood your question). I am not sure that you can simply rename your library from Battle.lib to Battle.a by changing its extension.

Michael

Offline Vampyre_Dark

  • Regular
  • ***
  • Posts: 255
  • Hello!
    • Somewhere Over The Rainbow...
Re: Add a specific Library
« Reply #6 on: December 17, 2005, 10:42:06 pm »
xxx.lib files are for MSVC++

GCC (MinGW) uses a files, and the libraries are names libxxx.a. OpenGL32.lib is libopengl32.a in gcc-land.

There is a program in the bin folder called libimp or something like that to convert libs to a files, I don't know how / if it works.
C::B Wishlist
~BOYCOTT THE EVIL YELLOW BOXES~

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: Add a specific Library
« Reply #7 on: December 17, 2005, 11:06:57 pm »
There is a program in the bin folder called libimp or something like that to convert libs to a files, I don't know how / if it works.
Almost :)  reimp
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

Offline Michael

  • Lives here!
  • ****
  • Posts: 1608
Re: Add a specific Library
« Reply #8 on: December 17, 2005, 11:09:33 pm »
There is a program in the bin folder called libimp or something like that to convert libs to a files, I don't know how / if it works.

Yes, you're right. The tool in question is reimp:

Quote
reimp is a tool to convert Microsoft's new-style (short) import libraries to import libraries for the Win32 ports of GNU tools (MinGW, Cygwin)

Usage:

Quote
reimp reads an MS import library and writes all imports to the corresponding .DEF file(s) that it feeds to dlltool that creates the import library. reimp also attempts to write to the current directory every static member that is found.

Michael

gl0be

  • Guest
Re: Add a specific Library
« Reply #9 on: December 17, 2005, 11:52:29 pm »
thank you for you response !!!

But I don't have any reimp in the bin directory of mingw !!
Do I have to download something more ?

I find that link

http://jrfonseca.planetaclix.pt/projects/gnu-win32/software/reimp/

and this one but I don't know what to do !

http://sourceforge.net/project/showfiles.php?group_id=2435&release_id=115457


Offline Michael

  • Lives here!
  • ****
  • Posts: 1608
Re: Add a specific Library
« Reply #10 on: December 18, 2005, 12:59:13 am »
But I don't have any reimp in the bin directory of mingw !!
Do I have to download something more ?

Well, I have reimp in the C::B bin directory (C::B version RC2 with MinGW included).

I find that link

http://jrfonseca.planetaclix.pt/projects/gnu-win32/software/reimp/

and this one but I don't know what to do !

http://sourceforge.net/project/showfiles.php?group_id=2435&release_id=115457

Or you can try here.

Michael

gl0be

  • Guest
Re: Add a specific Library
« Reply #11 on: December 18, 2005, 03:08:10 pm »
Thank you for your help !

I've done that :

      > reimp battle.lib (that creat a battle.obj)
      > ar rcs battle.obj battle.a (This packages the library)

Than I've got a lot's of error I really don't understand

So I give up  :?

Thanks a lot of your help anyway !

gl0be

Offline SamT

  • Multiple posting newcomer
  • *
  • Posts: 41
Re: Add a specific Library
« Reply #12 on: December 18, 2005, 04:16:53 pm »
      > reimp battle.lib (that creat a battle.obj)
      > ar rcs battle.obj battle.a (This packages the library)

In the README file, the command is not the same as yours.

        reimp imp.lib          # this generates several .o or .obj files.
        ar rcs libimp.a *.obj  # add them to library

Maybe you you need to try again  :)