From: JonY <jo...@us...> - 2011-06-25 01:34:25
|
On 6/25/2011 01:47, Daniel Kovacevic wrote: > I want to add the Sockets library (version 2.3.9.5) at > http://www.alhem.net/Sockets/index.html to my compiler (Mingw32 version > 4.5.2). > > I am not using cygwin, I am using the windows port of mingw32. > > I was able to compile the library using mingw32-make. > > However, I am having difficulty in compiling an example that came with the > library source. Specifically, "echoserver.cpp". > > When I initially tried to compile this program, I did not tell mingw where > the newly compiled library was; obviously a lot of errors where thrown. > > I looked into how to add said library to mingw. > > With that info, I decided to dump the library into the <mingw install > root>\lib directory. I included all of the .o and .d files along with > "libSockets.a". > Only the .a file is needed. > Next, I dumped everything else (.cpp, .h) into the <mingw install > root>\include directory. Here I had one problem crop up- "semaphore.h" was a > duplicate (it was in the newly compiled directory, and there was a copy in > the <mingw install root>\include directory). > I believe the mingw semaphore.h is part of pthreads. I suggest you use -I and -L to add to the GCC search path instead of clobbering your mingw install. > > [code] > > > C:\Users\DKOVAC~1\AppData\Local\Temp\ccAO9Vef.o:echoserver.cpp:(.text$_ZN12ListenSocketI8MySocketE4BindER13SocketAddressRKSsi[ListenSocket<MySocket>::Bind(SocketAddress&, > std::basic_string<char, std::char_traits<char>, std::allocator<char> > > const&, int)]+0xfe): undefined reference to `StrError(int)' > C:\Users\DKOVAC~1\AppData\Local\Temp\ccAO9Vef.o:echoserver.cpp:(.text$_ZN12ListenSocketI8MySocketE4BindER13SocketAddressRKSsi[ListenSocket<MySocket>::Bind(SocketAddress&, > std::basic_string<char, std::char_traits<char>, std::allocator<char> > > const&, int)]+0x1ad): undefined reference to `StrError(int)' > C:\Users\DKOVAC~1\AppData\Local\Temp\ccAO9Vef.o:echoserver.cpp:(.text$_ZN12ListenSocketI8MySocketE4BindER13SocketAddressRKSsi[ListenSocket<MySocket>::Bind(SocketAddress&, > std::basic_string<char, std::char_traits<char>, std::allocator<char> > > const&, int)]+0x2dc): undefined reference to `StrError(int)' > C:\Users\DKOVAC~1\AppData\Local\Temp\ccAO9Vef.o:echoserver.cpp:(.text$_ZN12ListenSocketI8MySocketE4BindER13SocketAddressRKSsi[ListenSocket<MySocket>::Bind(SocketAddress&, > std::basic_string<char, std::char_traits<char>, std::allocator<char> > > const&, int)]+0x38b): undefined reference to `StrError(int)' > C:\Users\DKOVAC~1\AppData\Local\Temp\ccAO9Vef.o:echoserver.cpp:(.text$_ZN12ListenSocketI15HttpDebugSocketE4BindER13SocketAddressRKSsi[ListenSocket<HttpDebugSocket>::Bind(SocketAddress&, > std::basic_string<char, std::char_traits<char>, std::allocator<char> > > const&, int)]+0xfe): undefined reference to `StrError(int)' > C:\Users\DKOVAC~1\AppData\Local\Temp\ccAO9Vef.o:echoserver.cpp:(.text$_ZN12ListenSocketI15HttpDebugSocketE4BindER13SocketAddressRKSsi[ListenSocket<HttpDebugSocket>::Bind(SocketAddress&, > std::basic_string<char, std::char_traits<char>, std::allocator<char> > > const&, int)]+0x1ad): more undefined references to `StrError(int)' follow > c:/mingw/bin/../lib/gcc/mingw32/4.5.2/../../../libSockets.a(Thread.o): In > function `Thread': > c:\Users\dkovacevic\Downloads\Binaries_and_Sources\C++\Sockets-2.3.9.5/Thread.cpp:54: > undefined reference to `Semaphore::Semaphore(long)' > c:\Users\dkovacevic\Downloads\Binaries_and_Sources\C++\Sockets-2.3.9.5/Thread.cpp:73: > undefined reference to `Semaphore::Post()' > c:\Users\dkovacevic\Downloads\Binaries_and_Sources\C++\Sockets-2.3.9.5/Thread.cpp:54: > undefined reference to `Semaphore::~Semaphore()' > c:/mingw/bin/../lib/gcc/mingw32/4.5.2/../../../libSockets.a(Thread.o): In > function `~Thread': > c:\Users\dkovacevic\Downloads\Binaries_and_Sources\C++\Sockets-2.3.9.5/Thread.cpp:77: > undefined reference to `Semaphore::~Semaphore()' > c:/mingw/bin/../lib/gcc/mingw32/4.5.2/../../../libSockets.a(Thread.o):c:\Users\dkovacevic\Downloads\Binaries_and_Sources\C++\Sockets-2.3.9.5/Thread.cpp:146: > undefined reference to `Semaphore::Post()' > c:/mingw/bin/../lib/gcc/mingw32/4.5.2/../../../libSockets.a(Thread.o): In > function `~Thread': > c:\Users\dkovacevic\Downloads\Binaries_and_Sources\C++\Sockets-2.3.9.5/Thread.cpp:77: > undefined reference to `Semaphore::~Semaphore()' > c:/mingw/bin/../lib/gcc/mingw32/4.5.2/../../../libSockets.a(Thread.o):c:\Users\dkovacevic\Downloads\Binaries_and_Sources\C++\Sockets-2.3.9.5/Thread.cpp:170: > undefined reference to `Semaphore::Wait()' > c:/mingw/bin/../lib/gcc/mingw32/4.5.2/../../../libSockets.a(ResolvServer.o):c:\Users\dkovacevic\Downloads\Binaries_and_Sources\C++\Sockets-2.3.9.5/ListenSocket.h:341: > undefined reference to `StrError(int)' > c:/mingw/bin/../lib/gcc/mingw32/4.5.2/../../../libSockets.a(ResolvServer.o):c:\Users\dkovacevic\Downloads\Binaries_and_Sources\C++\Sockets-2.3.9.5/ListenSocket.h:290: > undefined reference to `StrError(int)' > c:/mingw/bin/../lib/gcc/mingw32/4.5.2/../../../libSockets.a(ResolvServer.o):c:\Users\dkovacevic\Downloads\Binaries_and_Sources\C++\Sockets-2.3.9.5/ListenSocket.h:293: > undefined reference to `StrError(int)' > c:/mingw/bin/../lib/gcc/mingw32/4.5.2/../../../libSockets.a(ResolvServer.o):c:\Users\dkovacevic\Downloads\Binaries_and_Sources\C++\Sockets-2.3.9.5/ListenSocket.h:299: > undefined reference to `StrError(int)' > c:/mingw/bin/../lib/gcc/mingw32/4.5.2/../../../libSockets.a(ResolvServer.o):c:\Users\dkovacevic\Downloads\Binaries_and_Sources\C++\Sockets-2.3.9.5/ListenSocket.h:302: > undefined reference to `StrError(int)' > c:/mingw/bin/../lib/gcc/mingw32/4.5.2/../../../libSockets.a(SocketHandlerThread.o):c:\Users\dkovacevic\Downloads\Binaries_and_Sources\C++\Sockets-2.3.9.5/SocketHandlerThread.cpp:63: > undefined reference to `Semaphore::Post()' > c:/mingw/bin/../lib/gcc/mingw32/4.5.2/../../../libSockets.a(SocketHandlerThread.o): > In function `~SocketHandlerThread': > c:\Users\dkovacevic\Downloads\Binaries_and_Sources\C++\Sockets-2.3.9.5/SocketHandlerThread.cpp:48: > undefined reference to `Semaphore::~Semaphore()' > c:/mingw/bin/../lib/gcc/mingw32/4.5.2/../../../libSockets.a(SocketHandlerThread.o): > In function `SocketHandlerThread': > c:\Users\dkovacevic\Downloads\Binaries_and_Sources\C++\Sockets-2.3.9.5/SocketHandlerThread.cpp:43: > undefined reference to `Semaphore::Semaphore(long)' > c:/mingw/bin/../lib/gcc/mingw32/4.5.2/../../../libSockets.a(SocketHandlerThread.o):c:\Users\dkovacevic\Downloads\Binaries_and_Sources\C++\Sockets-2.3.9.5/SocketHandlerThread.cpp:75: > undefined reference to `Semaphore::Wait()' > c:/mingw/bin/../lib/gcc/mingw32/4.5.2/../../../libSockets.a(UdpSocket.o):c:\Users\dkovacevic\Downloads\Binaries_and_Sources\C++\Sockets-2.3.9.5/UdpSocket.cpp:371: > undefined reference to `StrError(int)' > c:/mingw/bin/../lib/gcc/mingw32/4.5.2/../../../libSockets.a(UdpSocket.o):c:\Users\dkovacevic\Downloads\Binaries_and_Sources\C++\Sockets-2.3.9.5/UdpSocket.cpp:556: > undefined reference to `StrError(int)' > c:/mingw/bin/../lib/gcc/mingw32/4.5.2/../../../libSockets.a(UdpSocket.o):c:\Users\dkovacevic\Downloads\Binaries_and_Sources\C++\Sockets-2.3.9.5/UdpSocket.cpp:531: > undefined reference to `StrError(int)' > c:/mingw/bin/../lib/gcc/mingw32/4.5.2/../../../libSockets.a(UdpSocket.o):c:\Users\dkovacevic\Downloads\Binaries_and_Sources\C++\Sockets-2.3.9.5/UdpSocket.cpp:229: > undefined reference to `StrError(int)' > c:/mingw/bin/../lib/gcc/mingw32/4.5.2/../../../libSockets.a(UdpSocket.o):c:\Users\dkovacevic\Downloads\Binaries_and_Sources\C++\Sockets-2.3.9.5/UdpSocket.cpp:327: > undefined reference to `StrError(int)' > c:/mingw/bin/../lib/gcc/mingw32/4.5.2/../../../libSockets.a(UdpSocket.o):c:\Users\dkovacevic\Downloads\Binaries_and_Sources\C++\Sockets-2.3.9.5/UdpSocket.cpp:581: > more undefined references to `StrError(int)' follow > collect2: ld returned 1 exit status > > [/code] > Are you sure its just libSockets.a? The Semaphore class has to come from somewhere, unless its a template only class in semaphore.h. |