Linker Errors with IrrBullet?

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
Ruxify
Posts: 33
Joined: Tue Oct 16, 2012 12:37 am

Linker Errors with IrrBullet?

Post by Ruxify »

Hello. I'm a major C++ noob, but have some C experience, and a TON of basic-based language experience. One thing I can barely understand however is "linking things" or at least I think I understand it, but I still get these strange errors that seem to only occur with all/any physics engines I've tried so far. (Irrlicht works fine.)

So I followed the instructions exactly (included all the include directories in order, added all the .a files in order to the linker) and I'm getting these errors on compile:

My IDE is Orwell Dev-C++ (The only IDE I could get to compile C++ code somehow, C::B didn't work)

Code: Select all

Compiler: MinGW GCC 4.7.0 32-bit
Building Makefile "F:\Files\Programs\Dev-Cpp\Projects\Tests\Irrlicht Test1\Makefile.win"
Executing  make...
mingw32-make.exe -f "F:\Files\Programs\Dev-Cpp\Projects\Tests\Irrlicht Test1\Makefile.win" all
g++.exe -c main.cpp -o main.o -I"F:/Files/Programs/Dev-Cpp/MinGW32/include" -I"F:/Files/Programs/Dev-Cpp/MinGW32/include/irrlicht-1.8/include" -I"F:/Files/Programs/Dev-Cpp/MinGW32/include/irrlicht-1.8/irrBullet/source" -I"F:/Files/Programs/Dev-Cpp/MinGW32/include/irrlicht-1.8/irrBullet/source/bheaders/Bullet" -I"F:/Files/Programs/Dev-Cpp/MinGW32/include/irrlicht-1.8/irrBullet/source/bheaders" 
 
g++.exe main.o  -o "Irrlicht Test 1.exe" -L"F:/Files/Programs/Dev-Cpp/MinGW32/lib" -static-libstdc++ -static-libgcc -L"F:/Files/Programs/Dev-Cpp/MinGW32/include/irrlicht-1.8/lib/Win32-visualstudio" ../../../MinGW32/include/irrlicht-1.8/lib/Win32-visualstudio/Irrlicht.lib ../../../MinGW32/include/irrlicht-1.8/irrBullet/lib/win32_gcc/Release/libirrBullet.a ../../../MinGW32/include/irrlicht-1.8/irrBullet/lib/win32_gcc/libBulletDynamics.a ../../../MinGW32/include/irrlicht-1.8/irrBullet/lib/win32_gcc/libBulletSoftBody.a ../../../MinGW32/include/irrlicht-1.8/irrBullet/lib/win32_gcc/libGIMPACTUtils.a ../../../MinGW32/include/irrlicht-1.8/irrBullet/lib/win32_gcc/libLinearMath.a ../../../MinGW32/include/irrlicht-1.8/irrBullet/lib/win32_gcc/libBulletCollision.a 
 
../../../MinGW32/include/irrlicht-1.8/irrBullet/lib/win32_gcc/libBulletDynamics.a(btTypedConstraint.o):btTypedConstraint.cpp:(.text+0x408): undefined reference to `___gxx_personality_sj0'
../../../MinGW32/include/irrlicht-1.8/irrBullet/lib/win32_gcc/libBulletDynamics.a(btTypedConstraint.o):btTypedConstraint.cpp:(.text+0x41e): undefined reference to `__Unwind_SjLj_Register'
../../../MinGW32/include/irrlicht-1.8/irrBullet/lib/win32_gcc/libBulletDynamics.a(btTypedConstraint.o):btTypedConstraint.cpp:(.text+0x48a): undefined reference to `__Unwind_SjLj_Unregister'
../../../MinGW32/include/irrlicht-1.8/irrBullet/lib/win32_gcc/libBulletDynamics.a(btTypedConstraint.o):btTypedConstraint.cpp:(.text+0x4d1): undefined reference to `__Unwind_SjLj_Resume'
../../../MinGW32/include/irrlicht-1.8/irrBullet/lib/win32_gcc/libBulletDynamics.a(btRigidBody.o):btRigidBody.cpp:(.text+0x26c2): undefined reference to `___gxx_personality_sj0'
../../../MinGW32/include/irrlicht-1.8/irrBullet/lib/win32_gcc/libBulletDynamics.a(btRigidBody.o):btRigidBody.cpp:(.text+0x2708): undefined reference to `__Unwind_SjLj_Register'
../../../MinGW32/include/irrlicht-1.8/irrBullet/lib/win32_gcc/libBulletDynamics.a(btRigidBody.o):btRigidBody.cpp:(.text+0x2865): undefined reference to `__Unwind_SjLj_Unregister'
../../../MinGW32/include/irrlicht-1.8/irrBullet/lib/win32_gcc/libBulletDynamics.a(btRigidBody.o):btRigidBody.cpp:(.text+0x2908): undefined reference to `__Unwind_SjLj_Resume'
../../../MinGW32/include/irrlicht-1.8/irrBullet/lib/win32_gcc/libBulletDynamics.a(btRigidBody.o):btRigidBody.cpp:(.text+0x295f): undefined reference to `___gxx_personality_sj0'
../../../MinGW32/include/irrlicht-1.8/irrBullet/lib/win32_gcc/libBulletDynamics.a(btRigidBody.o):btRigidBody.cpp:(.text+0x2998): undefined reference to `__Unwind_SjLj_Register'
../../../MinGW32/include/irrlicht-1.8/irrBullet/lib/win32_gcc/libBulletDynamics.a(btRigidBody.o):btRigidBody.cpp:(.text+0x2af5): undefined reference to `__Unwind_SjLj_Unregister'
../../../MinGW32/include/irrlicht-1.8/irrBullet/lib/win32_gcc/libBulletDynamics.a(btRigidBody.o):btRigidBody.cpp:(.text+0x2b98): undefined reference to `__Unwind_SjLj_Resume'
../../../MinGW32/include/irrlicht-1.8/irrBullet/lib/win32_gcc/libBulletDynamics.a(btRigidBody.o):btRigidBody.cpp:(.text+0x2be5): undefined reference to `___gxx_personality_sj0'
../../../MinGW32/include/irrlicht-1.8/irrBullet/lib/win32_gcc/libBulletDynamics.a(btRigidBody.o):btRigidBody.cpp:(.text+0x2c04): undefined reference to `__Unwind_SjLj_Register'
../../../MinGW32/include/irrlicht-1.8/irrBullet/lib/win32_gcc/libBulletDynamics.a(btRigidBody.o):btRigidBody.cpp:(.text+0x2c77): undefined reference to `__Unwind_SjLj_Unregister'
../../../MinGW32/include/irrlicht-1.8/irrBullet/lib/win32_gcc/libBulletDynamics.a(btRigidBody.o):btRigidBody.cpp:(.text+0x2cf1): undefined reference to `__Unwind_SjLj_Resume'
../../../MinGW32/include/irrlicht-1.8/irrBullet/lib/win32_gcc/libBulletDynamics.a(btRigidBody.o):btRigidBody.cpp:(.text+0x2d35): undefined reference to `___gxx_personality_sj0'
../../../MinGW32/include/irrlicht-1.8/irrBullet/lib/win32_gcc/libBulletDynamics.a(btRigidBody.o):btRigidBody.cpp:(.text+0x2d54): undefined reference to `__Unwind_SjLj_Register'
../../../MinGW32/include/irrlicht-1.8/irrBullet/lib/win32_gcc/libBulletDynamics.a(btRigidBody.o):btRigidBody.cpp:(.text+0x2dc7): undefined reference to `__Unwind_SjLj_Unregister'
../../../MinGW32/include/irrlicht-1.8/irrBullet/lib/win32_gcc/libBulletDynamics.a(btRigidBody.o):btRigidBody.cpp:(.text+0x2e41): undefined reference to `__Unwind_SjLj_Resume'
../../../MinGW32/include/irrlicht-1.8/irrBullet/lib/win32_gcc/libBulletDynamics.a(btRigidBody.o):btRigidBody.cpp:(.text$_ZN11btRigidBodyD0Ev[btRigidBody::~btRigidBody()]+0x15): undefined reference to `___gxx_personality_sj0'
../../../MinGW32/include/irrlicht-1.8/irrBullet/lib/win32_gcc/libBulletDynamics.a(btRigidBody.o):btRigidBody.cpp:(.text$_ZN11btRigidBodyD0Ev[btRigidBody::~btRigidBody()]+0x34): undefined reference to `__Unwind_SjLj_Register'
../../../MinGW32/include/irrlicht-1.8/irrBullet/lib/win32_gcc/libBulletDynamics.a(btRigidBody.o):btRigidBody.cpp:(.text$_ZN11btRigidBodyD0Ev[btRigidBody::~btRigidBody()]+0xaf): undefined reference to `__Unwind_SjLj_Unregister'
../../../MinGW32/include/irrlicht-1.8/irrBullet/lib/win32_gcc/libBulletDynamics.a(btRigidBody.o):btRigidBody.cpp:(.text$_ZN11btRigidBodyD0Ev[btRigidBody::~btRigidBody()]+0xf5): undefined reference to `__Unwind_SjLj_Resume'
../../../MinGW32/include/irrlicht-1.8/irrBullet/lib/win32_gcc/libBulletDynamics.a(btRigidBody.o):btRigidBody.cpp:(.text$_ZN11btRigidBodyD1Ev[btRigidBody::~btRigidBody()]+0x15): undefined reference to `___gxx_personality_sj0'
../../../MinGW32/include/irrlicht-1.8/irrBullet/lib/win32_gcc/libBulletDynamics.a(btRigidBody.o):btRigidBody.cpp:(.text$_ZN11btRigidBodyD1Ev[btRigidBody::~btRigidBody()]+0x34): undefined reference to `__Unwind_SjLj_Register'
../../../MinGW32/include/irrlicht-1.8/irrBullet/lib/win32_gcc/libBulletDynamics.a(btRigidBody.o):btRigidBody.cpp:(.text$_ZN11btRigidBodyD1Ev[btRigidBody::~btRigidBody()]+0xa4): undefined reference to `__Unwind_SjLj_Unregister'
../../../MinGW32/include/irrlicht-1.8/irrBullet/lib/win32_gcc/libBulletDynamics.a(btRigidBody.o):btRigidBody.cpp:(.text$_ZN11btRigidBodyD1Ev[btRigidBody::~btRigidBody()]+0xea): undefined reference to `__Unwind_SjLj_Resume'
collect2.exe: error: ld returned 1 exit status
 
F:\Files\Programs\Dev-Cpp\Projects\Tests\Irrlicht Test1\Makefile.win:26: recipe for target '"Irrlicht' failed
mingw32-make.exe: *** ["Irrlicht] Error 1
 
Execution terminated
And here is my script so far (it isn't much):

Code: Select all

//Irrlicht Test 1
#include <iostream>
#include <irrlicht.h>
#include <irrBullet.h>
 
using namespace std;
using namespace irr;
using namespace core;
using namespace scene;
using namespace video;
using namespace io;
using namespace gui;
 
int main()
{
    IrrlichtDevice *id = createDevice(EDT_DIRECT3D9, dimension2d<u32>(800, 600), 32, true, true, false, 0);
    return 0;
}
I have no idea what all that nonsense means, so can somebody help please? Thanks in advance.
hendu
Posts: 2600
Joined: Sat Dec 18, 2010 12:53 pm

Re: Linker Errors with IrrBullet?

Post by hendu »

It means your libraries are incompatible, which means you use some downloaded binaries from somewhere, when you should have compiled bullet and all other libraries you use yourself.
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Re: Linker Errors with IrrBullet?

Post by hybrid »

Could be several things. Either the .a files were compiled with different compilers and are incompatible, or you have a wrong link order of the .a files, or it is a compiler bug (the latest mingw versions are weird...). This also happens if c++ files are compiled and linked using a c compiler, but your command line looks ok in this respect
Ruxify
Posts: 33
Joined: Tue Oct 16, 2012 12:37 am

Re: Linker Errors with IrrBullet?

Post by Ruxify »

Ok, then how come this problem didn't happen with the pre-compiled Irrlicht libraries? And should I just compile the regular Bullet libraries then replace the .a files that irrBullet comes with? Can you do this with Dev-C++ or should I use something else?
hendu
Posts: 2600
Joined: Sat Dec 18, 2010 12:53 pm

Re: Linker Errors with IrrBullet?

Post by hendu »

Ok, then how come this problem didn't happen with the pre-compiled Irrlicht libraries?
Pure luck.
And should I just compile the regular Bullet libraries then replace the .a files that irrBullet comes with?
Yes, and the Irrlicht library, and the IrrBullet library, and any other libraries you currently have as downloaded binaries.
serengeor
Posts: 1712
Joined: Tue Jan 13, 2009 7:34 pm
Location: Lithuania

Re: Linker Errors with IrrBullet?

Post by serengeor »

Can you do this with Dev-C++ or should I use something else?
Yes you should use something else.. Burn the books you have that teach about it. And if you have a teacher that teaches it, slap her/him in the face.

No but really, don't use Dev-C++ unless you really have a good reason to do so.

Code::Blocks will works just fine if you'll configure it properly.
Working on game: Marrbles (Currently stopped).
hendu
Posts: 2600
Joined: Sat Dec 18, 2010 12:53 pm

Re: Linker Errors with IrrBullet?

Post by hendu »

@serengeor: It's developed again, the OP shows it uses gcc 4.7.0 now. So it shouldn't be that bad anymore.
serengeor
Posts: 1712
Joined: Tue Jan 13, 2009 7:34 pm
Location: Lithuania

Re: Linker Errors with IrrBullet?

Post by serengeor »

hendu wrote:@serengeor: It's developed again, the OP shows it uses gcc 4.7.0 now. So it shouldn't be that bad anymore.
Still, even if it had some "upgrades" I wouldn't count on it just yet, it has been out of business for a bit too long.

Also I couldn't find where it would say that it supports gcc 4.7~ on their main page.

http://www.bloodshed.net/dev/NEWS.txt

I'm just saying I wouldn't really recommend it right now. And to be honest, I don't think it would be that smart to upgrade it after so much time.
Working on game: Marrbles (Currently stopped).
Ruxify
Posts: 33
Joined: Tue Oct 16, 2012 12:37 am

Re: Linker Errors with IrrBullet?

Post by Ruxify »

The version I'm using's website is here: http://orwelldevcpp.blogspot.com/

Sigh, the thing is, when I just tried to use the actual Bullet libraries about a month ago, I used an express copy of visual studio 2010 to compile the libraries. However, I STILL got those same annoying linker errors.

Also, I would LOVE to use Visual Studio, except my computer seems to be extremely messed up, as when I try to start a project in it, it just says that project creation has failed, and sometimes tells me it isn't able to access the registry for some reason, even when I run it as administrator.

I couldn't get C::B to compile anything when I tried it, not even a simple Hello World program. xD
hendu
Posts: 2600
Joined: Sat Dec 18, 2010 12:53 pm

Re: Linker Errors with IrrBullet?

Post by hendu »

You mixed VS-compiled libraries with GCC-compiled app? That's not really supposed to work either.
serengeor
Posts: 1712
Joined: Tue Jan 13, 2009 7:34 pm
Location: Lithuania

Re: Linker Errors with IrrBullet?

Post by serengeor »

Anyways.
For the errors in the first post:http://stackoverflow.com/questions/7751 ... nality-sj0
These sorts of linker errors will occur is you try to mix objects that were compiled with different exception handling implementations in a single executable. It appears that you are using a DW2 GCC, but some library that you are attempting to use was compiled with a sjlj version of GCC, leading to these errors.

The short answer is that these sorts of problems are caused by ABI incompatibilities between different compilers, and so occur when you mix libraries compiled with different compilers, or use incompatible versions of the same compiler.
So what you should probably do is recompile bullet physics library, then irrlicht and lastly irrBullet
Working on game: Marrbles (Currently stopped).
Ruxify
Posts: 33
Joined: Tue Oct 16, 2012 12:37 am

Re: Linker Errors with IrrBullet?

Post by Ruxify »

Aha! I see what I did wrong with C::B, I didn't have any freaking compilers configured with it. I should have downloaded the version that came with them in the first place, but I guess I didn't. Hopefully, I should be able to use these libraries now.

If I get them working, I'll let you guys know.
newleon
Posts: 19
Joined: Mon Jan 10, 2011 7:59 am
Location: Pohang, South Korea
Contact:

Re: Linker Errors with IrrBullet?

Post by newleon »

If you are about to use MSVC2008 to compile the given examples in irrBullet, here is the solution to not encounter with these ugly linking errors.

I tried to compile the RaycastTank example. First I made an empty win32 console based application in VS2008. Then I copied the main.cpp, raycasttankexample.cpp, and raycasttankexample.h from "RaycastTank" folder to the newly made folder. Here comes the solution. You must copy and paste exampleframework.cpp and exampleframework.h from "framework" folder too. Then add all the *.h files to the Header Files section and the *.cpp files to the Source Files section.

Do not forget to modify this line
#include "../framework/exampleframework.h"
in raycasttankexample.h file to this one:
#include "exampleframework.h".

Add followings to the Additional Include Libraries, supposing that your irrlicht and irrBullet is installed in C:\irrlicht-1.7.2 and C:\irrBullet-0.1.8 folders respectively.
C:\irrlicht-1.7.2\include
C:\irrBullet-0.1.8\source
C:\irrBullet-0.1.8\source\bheaders
C:\irrBullet-0.1.8\source\bheaders\Bullet

The add followings to the Additional Library Directories.
C:\irrBullet-0.1.8\lib\win32_visualstudio\2008\Debug
C:\irrBullet-0.1.8\lib\win32_visualstudio\2008
C:\irrlicht-1.7.2\lib\Win32-visualstudio

And finally add these libraries in the given order.
irrBullet.lib
BulletDynamics.lib
BulletSoftBody.lib
GIMPACTUtils.lib
LinearMath.lib
BulletCollision.lib
irrlicht.lib

That's it. You are ready to compile this RaycastTank example. I did and it worked with no problem and linking errors.

One last point, when you extract irrBullet, in the C:\irrBullet-0.1.8\lib\win32_visualstudio\2008 folder, there is only "Release" version of the library. To make the deubg version, simply open and compile the C:\irrBullet-0.1.8\source\msvc\2008\irrBullet.sln in debug environment. Just be sure that the Additional Include Directories matches with the folders in your computer.

Good luck.
Ruxify
Posts: 33
Joined: Tue Oct 16, 2012 12:37 am

Re: Linker Errors with IrrBullet?

Post by Ruxify »

Ok, so I got code-blocks working finally, and I went into the Bullet libraries, and found a file called: "0BulletPhysics.sln" or something like that. I opened it in Code-Blocks then went to each of the four things titled "SoftBodies", "Dynamics", "Collisions", "Linear Math" I think. I right clicked them, and hit build (in that order). The process was successful, or at least I think it was, as it didn't even give me any errors. However, I couldn't find .a files or even .lib files anywhere, as if it didn't do anything. ...help?

I also have another kind of unrelated problem. There are some problems I'm having with the Irrlicht libraries, so far, I've noticed two: 1. Whenever I try to load a mesh, the program just crashes, and I know this happens when it can't find the file, but I put the .obj model in the same directory as the .exe file, and I set the mesh path as: "myobject.obj" for example, and it still crashes. I also copied the "HelloWorld" tutorial verbatim and it still doesn't work (and yes, I made sure the files were available). However, even with all this, I am still able to compile the source code for the example and it works.

The other problem I have is for some reason I can't set the position of or rotate the camera. It just sits there in the initial position of 0, 0, 0, no matter how many times I call the function.

I wish I could just get rid of these annoying problems. They are frustrating and scaring me away from C++. :(

(P.S. I kind of rushed this post, so, sorry for any grammatical/spelling errors.)
Post Reply