Link .lib in Eclipse CDT for Windows, Cygwin G++ linker [message #809173] |
Tue, 28 February 2012 15:06 |
Massimo Cristofolini Messages: 5 Registered: February 2012 |
Junior Member |
|
|
Hi everybody!
I've just installed Eclipse (I usually develop with MS Visual Studio and 'ol Borland Builder).
I'm trying to link a library (say, myLib.lib), stored in my project path (D:\Documenti\eclipse\workspace\HelloWorld), but I get an error.
Console output:
Building target: HelloWorld
Invoking: Cross G++ Linker
g++ -LD:\Documenti\eclipse\workspace\HelloWorld -o "HelloWorld" ./main.o -lmyLib
/usr/lib/gcc/i686-pc-cygwin/4.5.3/../../../../i686-pc-cygwin/bin/ld: cannot find -lmyLib
collect2: ld returned 1 exit status
make: *** [HelloWorld] Error 1
I've modified project Properties->C/C++ Build->Settings->Cross G++ Linker for Debug and Release mode adding the current path to the "Library search path" (both using '/' and '\'), adding the library in the "Library" field (with/without .lib, with/without entire path, ...) but without success.
I found some discussions about this, but most is for Linux version, and following the Windows oriented posts I get no results.
Any hint?
Maybe a step by step guide.
Thanks in advance for your help!
[Updated on: Tue, 28 February 2012 15:07] Report message to a moderator
|
|
|
|
|
|
Re: Link .lib in Eclipse CDT for Windows, Cygwin G++ linker [message #809990 is a reply to message #809905] |
Wed, 29 February 2012 14:34 |
Massimo Cristofolini Messages: 5 Registered: February 2012 |
Junior Member |
|
|
I made a couple of thests, but still without success.
Better talk about the specific problem first.
So, the libray (.lib) I need to link is a link library for a dll.
In Properties->C/C++ Build->Settings->Cross C++ Linker I've added "D:\Documenti\eclipse\workspace\HelloWorld" (where the DLL is) for -L option and "D:\Documenti\eclipse\workspace\HelloWorld\FlyCapture2.lib" in -l (complete .lib path).
The resulting command is:
g++ -L"D:\Documenti\eclipse\workspace\HelloWorld" -o "HelloWorld" ./main.o -lD:/Documenti/eclipse/workspace/HelloWorld/FlyCapture2.lib
-> file not found!
Adding the space before the .lib path in Cross C++ Linker option I get
g++ -L"D:\Documenti\eclipse\workspace\HelloWorld" -o "HelloWorld" ./main.o -l\ D:/Documenti/eclipse/workspace/HelloWorld/FlyCapture2.lib
like if the space is part of the path. of course, again, file not found.
I've added the space after -l option manually working from command line
g++ -L"D:\Documenti\eclipse\workspace\HelloWorld" -o "HelloWorld" ./main.o -l D:/Documenti/eclipse/workspace/HelloWorld/FlyCapture2.lib
Still no file found.
...what am I missing?
[Updated on: Wed, 29 February 2012 14:35] Report message to a moderator
|
|
|
|
Re: Link .lib in Eclipse CDT for Windows, Cygwin G++ linker [message #810001 is a reply to message #809990] |
Wed, 29 February 2012 14:52 |
Massimo Cristofolini Messages: 5 Registered: February 2012 |
Junior Member |
|
|
Update:
I renamed the library adding a"lib" prefix, but I forgot to delete it in the next tests. Shame on me!
The command
g++ -LD:/Documenti/eclipse/workspace/HelloWorld -o "HelloWorld" ./main.o -lFlyCapture2
finds the library (it seems so...), but I get "undefined references" to all the functions I call in the given namespace.
I'll try to figure this out (if there's some hints, they'll be appreciated!)
EDIT:
Late post! I'll read your link Axel, thanks.
[Updated on: Wed, 29 February 2012 14:53] Report message to a moderator
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04605 seconds