Box2D on code::Block weird error on b2wordl

Hello everybody.
I working on a school project that involves some physics and I was hoping to use Box2d on it but I am having some issues with the compiler.
I am using code blocks and this is the error that I am getting.

||=== test_box2d, Release ===|
obj\Release\main.o:main.cpp|| undefined reference to `b2World::b2World(b2Vec2 const&, bool)'|
obj\Release\main.o:main.cpp|| undefined reference to `b2World::~b2World()'|
obj\Release\main.o:main.cpp|| undefined reference to `b2World::~b2World()'|
||=== Build finished: 3 errors, 0 warnings ===|


I am trying to run the helloword sample that comes with box2d. I already add my header s to the main.cpp
#include <box2d.h>
I have been looking around and I was not able to find a solution for this, a few posts here on the forum but it did not solve my problem. Like this one (viewtopic.php?f=7&t=321&p=26880&hilit=codeblocks#p26880) . The weird thing is that some of the classes like b2Vec2 and b2BodyDef are working properly.
Does anyone have ever get the same problems I am getting. I will realy appreciate if someone points me to the right direction.

Thanks a lot
EPadilla
Ping? I'm having the same issue, it looks like.

Moreover, I can add that the b2World::b2World(const b2Vec2&, bool) constructor has been declared, from the looks of it, but not actually defined. I get the "undefined reference" error message when I try the code from the HelloWorld sample, but the following error message when I try to instantiate a b2World object using the wrong constructor:

Code:
note: candidates are: b2World::b2World(const b2Vec2&, bool)


So, clearly, parts of Box2D are working properly, but for some reason other parts seem to be missing.

So, yeah, any idea what's going on here? I'm running Ubuntu, built Box2D v2.1.2 using the exact commands listed in Building.txt, and then copied the library files into /lib manually.

Thanks in advance!
Usually this error just means that the .cpp was not part of the project, or was not part of the lib you made. Searching the build folders for a b2World.o file will tell you if it was compiled and is just not included, or was simply never compiled at all.
Hmm, b2World.o is there, so apparently it was compiled but not included. Any suggestions on fixing that?
Ah, right, C++ requires the extra step of linking libraries. Whoops ^_^;;. That's an embarrassing thing to have forgotten about...
I'm developing several projects using Box2D in XCode right now and wanted to throw out a little tip. Basically, the current version of Box2D (2.0.1) wouldn't compile on the first try in an openFrameworks project because of a conflict with with the old Carbon framework. There was a conflict between the Box2D struct called "Point" (line 291 of b2Distance.cpp) and a "Point" struct in MacTypes.h (in the Carbon framework). Several solutions online suggested doing a bunch of namespace wraps, but it's much simpler to just rename the Box2D Point struct and its single reference (line 313 in b2Distance.cpp) to b2Point. Then everything compiles and works nicely in an openFrameworks project.





😀
John Galt
Con Edison, Sales Consultant
Albany, New York

Original thread: https://box2d.org/forum/viewtopic.php?t=6504