Hi everyone,
I want to use box2d with Qt creator 5.1.1. With all examples on the internet I was able to build and run the example (testbed) by following this tutorial http://qtsimplify.blogspot.ch/2013/02/b ... th-qt.html. But when I try to use box2d in my own project (with all #include) but when I create my World, I have a build error:
undefined reference to `b2World::b2World(b2Vec2 const&)
undefined reference to `b2World::~b2World()
undefined reference to `b2World::~b2World()'
error: ld returned 1 exit status
here is my main.cpp
I tried with different version of Box2d, tried to download ".lib" and added them in my project but nothing works. I probably do something wrong but I can't find out.
So... How am I supposed to make box2d works in my own Qt project?
I want to use box2d with Qt creator 5.1.1. With all examples on the internet I was able to build and run the example (testbed) by following this tutorial http://qtsimplify.blogspot.ch/2013/02/b ... th-qt.html. But when I try to use box2d in my own project (with all #include) but when I create my World, I have a build error:
undefined reference to `b2World::b2World(b2Vec2 const&)
undefined reference to `b2World::~b2World()
undefined reference to `b2World::~b2World()'
error: ld returned 1 exit status
here is my main.cpp
Code:
#include "mainwindow.h"
#include <QApplication>
#include <Box2D/Box2D.h>
#include <Box2D/Dynamics/b2World.h>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
MainWindow w;
// Define the gravity vector.
b2Vec2 gravity(0.0f, -10.0f);
// Construct a world object, which will hold and simulate the rigid bodies.
b2World world(gravity);
w.show();
return a.exec();
}
#include <QApplication>
#include <Box2D/Box2D.h>
#include <Box2D/Dynamics/b2World.h>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
MainWindow w;
// Define the gravity vector.
b2Vec2 gravity(0.0f, -10.0f);
// Construct a world object, which will hold and simulate the rigid bodies.
b2World world(gravity);
w.show();
return a.exec();
}
I tried with different version of Box2d, tried to download ".lib" and added them in my project but nothing works. I probably do something wrong but I can't find out.
So... How am I supposed to make box2d works in my own Qt project?