I'm trying to use Box2D lib with SDL lib. NOTE that I only get the errors below after I link in SDL too. I think i link everything accordingly but in the end when I write up some code i get errors like:

1>------ Build started: Project: box2d test2, Configuration: Debug Win32 ------
1> main.cpp
1>Box2D.lib(b2PolygonShape.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '2' doesn't match value '0' in main.obj
1>Box2D.lib(b2BlockAllocator.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '2' doesn't match value '0' in main.obj
1>Box2D.lib(b2Settings.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '2' doesn't match value '0' in main.obj
1>SDLmain.lib(SDL_win32_main.obj) : error LNK2005: _main already defined in main.obj
1>LINK : warning LNK4098: defaultlib 'MSVCRTD' conflicts with use of other libs; use /NODEFAULTLIB:library
1>SDLmain.lib(SDL_win32_main.obj) : error LNK2019: unresolved external symbol _SDL_main referenced in function _main
1>c:\users\deividas\documents\visual studio 2010\Projects\box2d test2\Debug\box2d test2.exe : fatal error LNK1120: 1 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

This only happens when I start using the lib, not when I only include it. For now I'm just using code like this:

#include <Box2D\Box2D.h>

int main() {

    b2PolygonShape groundBox;
    b2FixtureDef boxShapeDef;
    boxShapeDef.shape = &groundBox;
    boxShapeDef.density = 2.0f;
    boxShapeDef.restitution = 0.5f;

	return 0;
}

Taken from: http://www.dreamincode.net/forums/topic/261881-sdl-with-box2d/ .
I googled something but did not exactly understood what to do, help would be appreciated.

If you get a linking error, make sure your functions names are exactly same as their prototypes. so, see if you might misspelled something

I'm pretty sure i would not get an error like this if I would misspell a function, thanks for the reply though.

so if this the case, did you add the library reference to the project?

I linked them ofcourse but maybe I did something wrong since it doesnt work. I linked them like I usually link libs. If do this in visual studio 08 I get the same message but in warning form so it works, but it still bothers me though. Im using vs10 btw.

yea sometime going between an old VS to a a newer one, can give you a long list to fix before you can run the application. good luck though.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.