News:

When registered with our forums, feel free to send a "here I am" post here to differ human beings from SPAM bots.

Main Menu

Add a specific Library

Started by gl0be, December 17, 2005, 06:24:35 PM

Previous topic - Next topic

gl0be

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 :

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

killerbot

did you specify the full path to the lib, or is the path added to the lib search dirs ??

gl0be

i try to use the both methods but's the probleme is the same... :?

Vampyre_Dark

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

#4
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

Michael

Quote from: gl0be 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

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
[url="http://img207.imageshack.us/img207/9728/411948picture4em.png"]http://img207.imageshack.us/img207/9728/411948picture4em.png[/url]

Vampyre_Dark

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~

thomas

Quote from: Vampyre_Dark on December 17, 2005, 10:42:06 PMThere 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."

Michael

Quote from: Vampyre_Dark on December 17, 2005, 10:42:06 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
[url="http://img207.imageshack.us/img207/9728/411948picture4em.png"]http://img207.imageshack.us/img207/9728/411948picture4em.png[/url]

gl0be

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


Michael

Quote from: gl0be on December 17, 2005, 11:52:29 PM
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).

Quote from: gl0be on December 17, 2005, 11:52:29 PM
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
[url="http://img207.imageshack.us/img207/9728/411948picture4em.png"]http://img207.imageshack.us/img207/9728/411948picture4em.png[/url]

gl0be

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

SamT

Quote from: gl0be on December 18, 2005, 03:08:10 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  :)