Unsolved Environment Variable
-
$$PWD\bullet3\src\BulletCollision/BroadphaseCollision/*.cpp
Wrong. Path separator is forward slash in qmake. And as already said above,
\b
is a special char like\t
and that will bite you. -
ok, thank you - i will replace the backslashes, but I just want to mention:
this settting is working ;-) -
@Guti said in Environment Variable:
this settting is working ;-)
Unfortunately this doesn't mean it is correct. And it can stop working from one day to another... so better fix it.
Regards
-
Build Bullet from source useing CMake GUI and MinGW. You will get libs (files with .a extension). Place "include" and "lib" folder in common folder, for example, in "Libs/Bullet"
Create an empty C++ project. Add these settings to .pro:
INCLUDEPATH += "E:\Libs\Bullet3-2.89\include" LIBS += -L"E:\Libs\Bullet3-2.89\lib" LIBS += -lBulletDynamics -lBulletCollision -lLinearMath SOURCES += \ main.cpp
Try to compile it:
main.cpp
#include <btBulletDynamicsCommon.h> int main() { btDefaultCollisionConfiguration *collisionConfiguration = new btDefaultCollisionConfiguration(); return EXIT_SUCCESS; }
It works.
-
But I found a very strange behavior. If I write like this:
LIBS += -lBulletCollision -lBulletDynamics -lLinearMath
I will get these errors:
btTypedConstraint.cpp:-1: error: undefined reference to
btCollisionObject::~btCollisionObject()'
btTypedConstraint.cpp:-1: error: undefined reference tobtCollisionObject::~btCollisionObject()' btRigidBody.cpp:-1: error: undefined reference to
btCollisionObject::btCollisionObject()'
btRigidBody.cpp:-1: error: undefined reference tobtCollisionObject::btCollisionObject()' btRigidBody.cpp:-1: error: undefined reference to
btCollisionObject::serialize(void*, btSerializer*) const'
btRigidBody.cpp:-1: error: undefined reference tobtCollisionObject::~btCollisionObject()' btRigidBody.cpp:-1: error: undefined reference to
btCollisionObject::~btCollisionObject()'
btRigidBody.cpp:-1: error: undefined reference tobtCollisionObject::~btCollisionObject()' btRigidBody.cpp:-1: error: undefined reference to
btCollisionObject::~btCollisionObject()'
btRigidBody.cpp:-1: error: undefined reference tobtCollisionObject::~btCollisionObject()'
But if I change the order of libs it works correctly:
LIBS += -lBulletDynamics -lBulletCollision -lLinearMath
-
@8Observer8
DoesBulletDynamics
reference something inBulletCollision
? The order of library linking is significant. -
@Guti have you solve the probem? I met the same trouble.The bullet package not found!
-
-
@JonB said in Environment Variable:
The order of library linking is significant.
Yes, I set this order of libraries and it works:
LIBS += -lBulletDynamics -lBulletCollision -lLinearMath
-
@8Observer8
Indeed, so it does. What do you find "a very strange behavior"? It is working as expected. Libraries expect to find other Libraries which resolve the first one's undefined references later on the linker line. If they came earlier the linker would not know they were needed by a later library. -
@JonB said in Environment Variable:
Indeed, so it does. What do you find "a very strange behavior"?
I didn't know before that the order of the libraries mattered, so I called it strange behavior, but now I know.
-
@8Observer8
Ah yes, OK. The linker processes its files once in a single pass, left to right (there is no "going back" leftwards). Only those modules in a library which resolve currently (i.e. at the instant they are encountered) wanted symbols are pulled into the target executable. Else it would have to include everything just in case it's wanted later, and that's not how libraries work. So basically arrange them with the "lowest level" libraries to the right.