Link .lib in Eclipse CDT for Windows, Cygwin G++ linker [message #809173] |
Tue, 28 February 2012 10:06  |
Eclipse User |
|
|
|
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 10:07] by Moderator
|
|
|
|
|
|
|
|
|
|
|
Re: Link .lib in Eclipse CDT for Windows, Cygwin G++ linker [message #812613 is a reply to message #810059] |
Sat, 03 March 2012 22:14  |
Eclipse User |
|
|
|
at least with CDT 8.1(which I'm using), this is working for me:
if the .lib file is located at : X:\foo\lib\foo.lib, add the library search path (-L) as "/cygdrive/x/foo/lib", and add Libraries (-l) as "foo".
and don't forget add the path of the DLL's container folder in you PATH environment variable.
for the "undefined references" problem, it maybe caused by calling conventions, try adding "__stdcall" before the function name in your library header file.
|
|
|
Powered by
FUDForum. Page generated in 0.04878 seconds