Compileing problem.

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
SirSami
Posts: 20
Joined: Mon Mar 24, 2008 2:18 pm
Location: Finland

Compileing problem.

Post by SirSami »

I was making a project with a raknet. Until a error appeared, the code was not compiled. Then I tried to test tutorial if that works. But it doesn't work. Same problem... It is saying something about Linker error and compile log says:

Code: Select all

Compiler: Default compiler
Building Makefile: "C:\Dev-Cpp\Makefile.win"
Executing  make clean
rm -f rakNET/Samples/ServerClientTest/ServerClientTest.o  Project1.exe

g++.exe -c rakNET/Samples/ServerClientTest/ServerClientTest.cpp -o rakNET/Samples/ServerClientTest/ServerClientTest.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/rakNET/Source"   

rakNET/Samples/ServerClientTest/ServerClientTest.cpp: In function `int main()':
rakNET/Samples/ServerClientTest/ServerClientTest.cpp:18: warning: taking address of temporary

rakNET/Samples/ServerClientTest/ServerClientTest.cpp:21: warning: taking address of temporary

g++.exe rakNET/Samples/ServerClientTest/ServerClientTest.o  -o "Project1.exe" -L"C:/Dev-Cpp/lib" -L"C:/Dev-Cpp/lib"    

rakNET/Samples/ServerClientTest/ServerClientTest.o(.text+0x34):ServerClientTest.cpp: undefined reference to `RakNetworkFactory::GetRakPeerInterface()'
rakNET/Samples/ServerClientTest/ServerClientTest.o(.text+0x76):ServerClientTest.cpp: undefined reference to `SocketDescriptor::SocketDescriptor()'
rakNET/Samples/ServerClientTest/ServerClientTest.o(.text+0xd7):ServerClientTest.cpp: undefined reference to `SocketDescriptor::SocketDescriptor(unsigned short, char const*)'
rakNET/Samples/ServerClientTest/ServerClientTest.o(.text+0x126):ServerClientTest.cpp: undefined reference to `RakNetworkFactory::DestroyRakPeerInterface(RakPeerInterface*)'
collect2: ld returned 1 exit status

make.exe: *** [Project1.exe] Error 1

Execution terminated
What can be the problem? Everything is fine but if add peer = RakNetworkFactory::GetRakPeerInterface(); line to my program it doesen't compile it. But if I only define a peer like this: RakPeerInterface *peer;
, it works well.
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Post by CuteAlien »

While I'm not exactly sure why you ask questions about RakNet on an Irrlicht forum, this looks like you don't link to the library containing those functions.

Creating an executable in c/c++ has two steps. In the first step modules are compiled and you can reference to other modules by including certain headers. You do that.

But after the compilation those modules must be linked together in the second step. I don't know how that library is called, but if it's name is for example libRaknet.a then for linking to it you would have to add the following parameter to the g++ commandline: -lRaknet
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Eigen
Competition winner
Posts: 375
Joined: Fri Jan 27, 2006 2:01 pm
Location: Estonia
Contact:

Post by Eigen »

I had the same problem once. If you're using Dev Cpp, you have to recompile RakNet. That should do it.
Post Reply