Muscle and DevC++

This topic is 5387 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

Recommended Posts

Hi, I'm trying to compile the Muscle server with DevC++5. The readme.txt to compile it with DevC++ sais:
Quote:
 In this directory you will find Dev-C++ 5 beta (4.9.50) project files, based on VC++ files made by Vitaliy Mikitchenko (aka "VitViper"). To compile muscle, do the following: 1. Open the "libmuscle.dev" project file in dev-c++ 2. Now press "Compile" button to build the library. 3. This will create a "libmuscle.a" static library in the same folder as the Dev-C++ projects ("dev-c++" folder). 4. Now open the "muscled.dev" file and press "Compile" button. This will create a "muscled.exe" file in the "Dev-C++" directory. Now you can just double-click it to run the server :).
libmuscle.dev compiles perfectly and creates a libmuscle.a file, which I put in the lib folder of DevCpp. But if I then try to compile muscled.dev (which uses the libmuscle.a library), I get thousands and thousands of linker errors! I tried with different versions of DevC++5, including version 4.9.5.0. Each version gives different linker errors. What's going on here? Linker errors are good in not telling anything at all, so I'm totally stunned here :( I also tried compiling the server in Linux, all you had to do there was type "make", and it compiled everything perfectly, including a few examples of clients using libmuscle. So the code is not wrong since in Linux it works. But I need to compile it for Windows too because the client has to be for Windows. What can I do to try to get it to work in DevC++?

Share on other sites
Just putting it in the lib folder isn't enough; are you actually telling the Dev-C++ linker to use the file?

Under the Project menu, select Project Options. Click the Parameters tab, and in the Linker textbox you have to enter your linker info... which in this case sounds like you should enter: -lmuscle

Hope this helps!

Ryan

Share on other sites
Yep, -lmuscle is already put in the linker parameters. It's a .dev file given in the muscle package, which had all necessary linker parameters set already, including -lmuscle, and at least 20 others.

Share on other sites
Post some of the exact error messages and maybe I can garner a clue. My only haphazard guess is that something happened with the changed gcc version?

(<-- is dev-cpp freak who has compile MUSCLE before)

Share on other sites
Cool, I'm glad to hear someone managed to compile it with devc++ :)

Ok here's a small selection of all the different errors, in the compile log. Most errors have to do with operator new, operator delete and dynamic cast.

There are also gxx_personality errors. I have got these before once, when using .o files compiled with an older version of gcc in a newer version of gcc. However now I've made sure that there are no such things and everything, both the libmuscle.a and the devmuscle.exe file, are compiled with the same compiler.

The first is not an error but I show the commands it gives to gcc.

Quote:
 Executing make...make.exe -f "...\Muscle\muscleDevCpp4990\dev-c++\Makefile.win" allgcc.exe ../server/muscled.o -o "muscled.exe" -L"D:/Programmeren/Dev-Cpp5/lib" -L"./" -lmuscle -lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladvapi32 -lshell32 -lole32 -loleaut32 -luuid -lodbc32 -lodbccp32 -lwsock32 ../server/muscled.o(.text+0xbbe):muscled.cpp: undefined reference to __gxx_personality_sj0'../server/muscled.o(.text+0x237f):muscled.cpp: undefined reference to operator new(unsigned)'../server/muscled.o(.text+0x2407):muscled.cpp: undefined reference to operator delete(void*)'../server/muscled.o(.text+0x324d):muscled.cpp: undefined reference to __gxx_personality_sj0'../server/muscled.o(.text$_ZN6muscle5QueueINS_6StringEED1Ev+0xc):muscled.cpp: undefined reference to __gxx_personality_sj0'../server/muscled.o(.text$_ZN6muscle9HashtableImNS_6StringENS_11HashFunctorImEEED1Ev+0x6d):muscled.cpp: undefined reference to operator delete[](void*)'D:/Programmeren/Dev-Cpp5/lib/libmuscle.a(StorageReflectSession.o)(.text$_ZN6muscle5QueueINS_3RefINS_21StorageReflectSession8DataNodeEEEE10RemoveTailEv+0xc):StorageReflectSession.cpp: undefined reference to __gxx_personality_sj0'D:/Programmeren/Dev-Cpp5/lib/libmuscle.a(ReflectServer.o)(.rdata$_ZTIN6muscle5QueueINS_3RefINS_21ReflectSessionFactoryEEEEE+0x0):ReflectServer.cpp: undefined reference to vtable for __cxxabiv1::__class_type_info'D:/Programmeren/Dev-Cpp5/lib/libmuscle.a(Message.o)(.text+0x625b):Message.cpp: undefined reference to __dynamic_cast'D:/Programmeren/Dev-Cpp5/lib/libmuscle.a(Message.o)(.rdata$_ZTVN6muscle13FlatCountableE+0x34):Message.cpp: undefined reference to __cxa_pure_virtual'D:/Programmeren/Dev-Cpp5/lib/libmuscle.a(Message.o)(.rdata$_ZTIN6muscle10ObjectPoolINS_13BoolDataArrayEEE+0x0):Message.cpp: undefined reference to vtable for __cxxabiv1::__si_class_type_info'D:/Programmeren/Dev-Cpp5/lib/libmuscle.a(Message.o)(.rdata\$_ZTIN6muscle10ObjectPoolINS_13BoolDataArrayEEE+0x0):Message.cpp: undefined reference to vtable for __cxxabiv1::__si_class_type_info' [General Error] Too many messages; abort. There must be something terribly wrong with your code. Please fix it.

Note how many of the errors come from libmuscle.a, so that means that it has successfully found that file so I put it in the correct folder.

The above are the errors from DevC++ 4.9.9.0.

There's also another problem, a DevC++ 4.9.9.0 bug: sometimes when trying to open the libmuscle.dev project, the IDE crashes!! Only when trying to open it in a few different ways (from recent files, by clicking the project in windows explorer, or by using the open dialog), and opening a few other projects now and then, it finaly manages to open it.

I can't access the #bloodshed irc channel, because the undernet server allows only 2 connections per IP, and about 40000 students share my external IP.

Share on other sites
Ok, well it looks like you're trying to compile C++ code with gcc... which won't work. You need to use g++.exe not gcc.exe.

That might solve all of your problems... but I also see that you don't have -lmingw32 in your linker string. As far as I know, all programs being compiled with mingw require that you link in the mingw32 library.

Hopes this helps!

Ryan

Share on other sites
Hi, indeed, all .cpp files didn't have the setting "compile as C++" enabled! So I enabled it, and also had to copy all "compiler" parameters to "c++ compiler parameters"

Everything is compiled with g++ now, and.... It still gives the same errors, again about new and delete :(

Now its all the time errors like:

" [Linker error] undefined reference to operator delete(void*)' "
" [Linker error] undefined reference to vtable for __cxxabiv1::__si_class_type_info' "
etc.... :(

[Edited by - Lode on October 14, 2004 1:22:38 PM]

Share on other sites
Quote:
 ../server/muscled.o(.text+0xbbe):muscled.cpp: undefined reference to __gxx_personality_sj0'

woah... I've never been able to solve personality errors when I've encountered them. From my understanding they should only occur when your not linking against the C++ std libs though...

Maybe try and create a new c++ project and wrap the files, see if that works?

Share on other sites
Ranger_One:

I did it, and was hoping quite hard that it'd work, but... I don't know if it's good or bad news, but it gives different errors:

Quote:
 D:/Programmeren/Dev-Cpp5/lib/libmuscle.a(ReflectServer.o)(.text+0x3046):ReflectServer.cpp: undefined reference to select@20'D:/Programmeren/Dev-Cpp5/lib/libmuscle.a(ReflectServer.o)(.text+0x33cc):ReflectServer.cpp: undefined reference to __WSAFDIsSet@8'D:/Programmeren/Dev-Cpp5/lib/libmuscle.a(ReflectServer.o)(.text+0x5ab3):ReflectServer.cpp: undefined reference to WSAGetLastError@0'D:/Programmeren/Dev-Cpp5/lib/libmuscle.a(AbstractReflectSession.o)(.text+0x166a):AbstractReflectSession.cpp: undefined reference to closesocket@4'D:/Programmeren/Dev-Cpp5/lib/libmuscle.a(Message.o)(.text+0x37c3):Message.cpp: undefined reference to muscle::GetByteBufferFromPool(unsigned long, unsigned char const*)'D:/Programmeren/Dev-Cpp5/lib/libmuscle.a(NetworkUtilityFunctions.o)(.text+0xe8):NetworkUtilityFunctions.cpp: undefined reference to ntohs@4'D:/Programmeren/Dev-Cpp5/lib/libmuscle.a(NetworkUtilityFunctions.o)(.text+0x154):NetworkUtilityFunctions.cpp: undefined reference to htons@4'D:/Programmeren/Dev-Cpp5/lib/libmuscle.a(SetupSystem.o)(.text+0xdc9):SetupSystem.cpp: undefined reference to timeGetTime@0'D:/Programmeren/Dev-Cpp5/lib/libmuscle.a(PathMatcher.o)(.text+0xd70):PathMatcher.cpp: undefined reference to muscle::InstantiateQueryFilter(muscle::Message const&)'D:/Programmeren/Dev-Cpp5/lib/libmuscle.a(MessageIOGateway.o)(.text+0xc1c):MessageIOGateway.cpp: undefined reference to `muscle::GetByteBufferFromPool(unsigned long, unsigned char const*)'

I'm still extremely bad at understanding linker errors, so I'm lost again :(

I mean, I compile everything, it's all correct C++ code, and then the linker tries to put it together, and the linker doesn't find all stuff or something? Why?

[Edited by - Lode on October 16, 2004 8:38:01 AM]

Share on other sites
It seems to be looking for:

-lws2_32
-lwinmm

also, it seems that it can't find some of it's own functions... don't know how to deal with that. Unless you missed one or more source files?

• 21
• 13
• 9
• 17
• 13