Noi Sek
Noi Sek

Reputation: 544

How do you compile Box2D for Code::Blocks/MinGW32 under Windows?

I've found similar questions across the internet, none of which helped me. The Code::Blocks workspace and project files included DO generate .a files, and I've moved them to Codeblocks/MinGW/lib, and I've moved the Box2D folder to Codeblocks/MinGW/include and yet the HelloWorld.cpp example still gives me these errors.

Upvotes: 1

Views: 2918

Answers (1)

iforce2d
iforce2d

Reputation: 8272

Looks like the project files you used to build the .a were missing some files. The file mentioned in the error message is one that was removed from Box2D after v2.1.2, so I'm guessing you are using 2.1.2 source code (or thereabouts) with project files from some other source?

In any case, setting these up yourself is really simple. In the 'Management' panel, right click the 'Engine' project, select Remove files and click OK to remove everything.

Remove code::blocks box2d files

Now do the same and select Add files recursively, choose the folder that contains Box2d.h file:

Code::blocks add box2d recursively

Click OK a few times, and you're done.

In your case, since you had it building already I would expect this to be ok now but for anyone arriving here wanting to setup a project file from scratch, you'll also need to specify the search path for the Box2D headers.

To do this, in the same right-click menu choose: Properties -> Project settings tab -> Project's build options button -> Search directories tab -> Add button. Now choose the parent folder of the one you just chose above.

Upvotes: 2

Related Questions