|
From: Daniel K. <dko...@gm...> - 2011-06-27 12:24:47
|
I added the "libpthreadGC2.a" lib and the "libpthreadGCE2.a" lib hoping that they were the missing libraries that pthreads in semaphore.h was referencing. No, I don't know whether or not I need to add more libraries to the compiler. The Sockets library said that you have to add libwsock32.a and libws2_32.a; no other libs were mentioned (http://www.alhem.net/Sockets/tutorial/install.html). Of course, the instructions were written with the assumption that you are attempting to compile under cygwin, which I am not. Could that be why the pthreads lib is missing? Is there another pthreads lib I should be using? I retrieved libwsock32.a and libws2_32.a from the system32 directory, but I wasn't able to find a "libpthreads.dll" in there. On 6/24/11, JonY <jo...@us...> wrote: > 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. > > |