Click here to Skip to main content
15,887,135 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hello,
Trying to compile and run the lightweight Client Server software project, with Dev-CPP IDE and the files are all in the correct directories, however there are many linker errors. Are there some other libs to be included other than the standard ones.?
Thanks
Sorry too vague first time. here is compile log.
Nick

Compiler: Default compiler
Building Makefile: "C:\MyCsources\Makefile.win"
Executing make...
mingw32-make.exe -f "C:\MyCsources\Makefile.win" all
g++.exe -D__DEBUG__ -c "../codeProject code/myClient.cpp" -o "../codeProject code/myClient.o" -I"C:/Dev-Cpp/lib/gcc/mingw32/3.4.2/include" -I"C:/Dev-Cpp/include/c++/3.4.2/backward" -I"C:/Dev-Cpp/include/c++/3.4.2/mingw32" -I"C:/Dev-Cpp/include/c++/3.4.2" -I"C:/Dev-Cpp/include" -I"C:/Dev-Cpp/include/sys" -I"C:/Dev-Cpp/include" -I"C:/Dev-Cpp/include/c++/3.4.2/debug" -g3

g++.exe -D__DEBUG__ "../codeProject code/myClient.o" -o "sunday222.exe" -L"C:/Dev-Cpp/lib" -L"C:/Dev-Cpp/lib" "../Program Files (x86)/Microsoft SDKs/Windows/v7.0A/Lib/WSock32.Lib" C:/Dev-Cpp/lib/debug/libstdc++.a -g3

../codeProject code/myClient.o(.text+0x271): In function `main':

C:/MyCsources/../codeProject code/myClient.cpp:29: undefined reference to `myException::myException(int, std::string const&)'
../codeProject code/myClient.o(.text+0x4ef):C:/MyCsources/../codeProject code/myClient.cpp:48: undefined reference to `myHostInfo::myHostInfo()'
../codeProject code/myClient.o(.text+0x77a):C:/MyCsources/../codeProject code/myClient.cpp:63: undefined reference to `myHostInfo::myHostInfo(std::string&, hostType)'
../codeProject code/myClient.o(.text+0x9ac):C:/MyCsources/../codeProject code/myClient.cpp:74: undefined reference to `mySocket::setLingerOnOff(bool)'
../codeProject code/myClient.o(.text+0x9c2):C:/MyCsources/../codeProject code/myClient.cpp:75: undefined reference to `mySocket::setLingerSeconds(int)'
../codeProject code/myClient.o(.text+0x9d8):C:/MyCsources/../codeProject code/myClient.cpp:77: undefined reference to `operator<<(std::ostream&, mySocket&)'
../codeProject code/myClient.o(.text+0xa12):C:/MyCsources/../codeProject code/myClient.cpp:79: undefined reference to `operator<<(std::ostream&, mySocket&)'
../codeProject code/myClient.o(.text+0xac2):C:/MyCsources/../codeProject code/myClient.cpp:84: undefined reference to `myTcpSocket::connectToServer(std::string&, hostType)'
../codeProject code/myClient.o(.text+0xc98):C:/MyCsources/../codeProject code/myClient.cpp:102: undefined reference to `myTcpSocket::sendMessage(std::string&)'
../codeProject code/myClient.o(.text+0xd2d):C:/MyCsources/../codeProject code/myClient.cpp:107: undefined reference to `myTcpSocket::recieveMessage(std::string&)'
../codeProject code/myClient.o(.text+0xfa2):C:/MyCsources/../codeProject code/myClient.cpp:124: undefined reference to `myException::myException(int, std::string const&)'
../codeProject code/myClient.o(.text+0x193b): In function `Z41__static_initialization_and_destruction_0ii':
C:/MyCsources/../codeProject code/myClient.cpp:9: undefined reference to `myLog::myLog()'
../codeProject code/myClient.o(.text+0x19fa):C:/MyCsources/../codeProject code/myClient.cpp:9: undefined reference to `myLog::~myLog()'
../codeProject code/myClient.o(.text$_ZN11myTcpSocketD1Ev[myTcpSocket::~myTcpSocket()]+0xb): In function `ZN8mySocketD0Ev':
C:/MyCsources/../codeProject code/myClient.cpp: undefined reference to `vtable for myTcpSocket'
../codeProject code/myClient.o(.text$_ZN11myTcpSocketC1Ei[myTcpSocket::myTcpSocket(int)]+0x14):C:/MyCsources/../codeProject code/myClient.cpp: undefined reference to `mySocket::mySocket(int)'
../codeProject code/myClient.o(.text$_ZN11myTcpSocketC1Ei[myTcpSocket::myTcpSocket(int)]+0x1d):C:/MyCsources/../codeProject code/myClient.cpp: undefined reference to `vtable for myTcpSocket'
../codeProject code/myClient.o(.text$_ZN11myExceptionD1Ev[myException::~myException()]+0xb):C:/MyCsources/../codeProject code/myClient.cpp: undefined reference to `vtable for myException'
collect2: ld returned 1 exit status

mingw32-make.exe: *** [sunday222.exe] Error 1

Execution terminated
Posted
Updated 27-Nov-11 9:28am
v2
Comments
LanFanNinja 24-Nov-11 10:56am    
What are the errors? What "lightweight Client Server software project"?
Albert Holguin 24-Nov-11 11:25am    
If you dont specify the linker errors, its hard to guess what may be missing.
Addy Tas 24-Nov-11 12:42pm    
With the abundance of missing information i can only guess that you are missing a ref to ws2_32.lib.
BrainlessLabs.com 24-Nov-11 13:50pm    
Can you please tell what Client server and what errors?
LanFanNinja 27-Nov-11 17:58pm    
For others reading this question I believe this is the link to the project the OP is trying to compile. pnickp please correct me if I am wrong.
http://www.codeproject.com/KB/IP/client_server_socket.aspx

1 solution

Part of your problem lies right here:
Quote:

g++.exe -D__DEBUG__ "../codeProject code/myClient.o" -o "sunday222.exe" -L"C:/Dev-Cpp/lib" -L"C:/Dev-Cpp/lib" "../Program Files (x86)/Microsoft SDKs/Windows/v7.0A/Lib/WSock32.Lib" C:/Dev-Cpp/lib/debug/libstdc++.a -g3


GCC and VC (static) libraries are NOT compatible. Here you're trying to include a VC lib into a GCC project. Whenever I use Winsock and GCC, I include ws2_32.a (it'll be in the /Dev-Cpp/Lib folder (have a close look - they're all .a files)


Something you may like to consider - Code::Blocks can be downloaded with the MinGW compiler suite (just as DevCpp can) It is however, still in active development, cross-platform (irrelevant to you, I assume) and
(*) It can load VS projects - you'd be surprised at just how much pain can be caused when you don't have all of the project settings. Importing a VS project is considerably faster and more reliable than re-creating a project from source code and trying to guess all of the build settings.

I also note from the first compile error that it seems likely that you need to include(in the build process, NOT via #include directives) a number of files called something like "myException.cpp" also "myTcpSocket.cpp".

I started with DevCpp, but after someone shared Code::Blocks with me haven't looked back (except for the odd devPak, which I can import using C::B anyways)
You can download the IDE on it's own for about 10-20 meg or so, you can even use the minGW compiler you already have (though it's likely the CB package with compiler included contains a more recent version of the compiler)
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900