Re: link error

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Moon Hwang wrote:

> I make my own library using this makefile.

You might consider using automake and libtool, which takes care of all
this for you.

> SONAME := lib$(TARGET)$(MODI).so

.so is not the universal extension for shared libraries.  Under windows
(and Cygwin) it's .dll, under darwin it's .dylib, and so on.  You really
shouldn't hardcode this information and expect to have a portable
makefile.

Under Cygwin the normal convention is that for a library named "foo" the
shared library is cygfoo.dll and the import libray is libfoo.dll.a.  If
it is a versioned library then it is cygfoo-n.dll and libfoo-n.dll.a.

> g++ -I /usr/X11R6/include -I ../../../Include -I
> /usr/local/include/boost_1_32_0 -L /usr/X11R6/lib -L
> /home/MHHwang/lib/Release Bomb.cpp -o Bomb  -lxyDEVS -lpthread
> 
> /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../i686-pc-cygwin/bin/ld:
> cannot find -lxyDEVS
> collect2: ld returned 1 exit status

Under Cygwin, when you specify -lxyDEVS, the linker will search for the
following filenames (in this order):

libxyDEVS.dll.a
xyDEVS.dll.a
libxyDEVS.a
cygxyDEVS.dll
libxyDEVS.dll
xyDEVS.dll

(As documented at
<http://sourceware.org/binutils/docs-2.16/ld/WIN32.html#WIN32>.)

So of course it errors because .so is not tne correct extension under
Cygwin.  You can still link against a .so file but you will probably
have to specify its full filename like with other link objects, as
opposed to -lfoo.

Brian

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux