1,105,340 Community Members

Visual c++ linking errors

Member Avatar
nuclear
Junior Poster
105 posts since Aug 2011
Reputation Points: -9 [?]
Q&As Helped to Solve: 3 [?]
Skill Endorsements: 0 [?]
 
0
 

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.

Member Avatar
Ab000dy_85
Junior Poster in Training
69 posts since Dec 2007
Reputation Points: -3 [?]
Q&As Helped to Solve: 8 [?]
Skill Endorsements: 0 [?]
 
0
 

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

Member Avatar
nuclear
Junior Poster
105 posts since Aug 2011
Reputation Points: -9 [?]
Q&As Helped to Solve: 3 [?]
Skill Endorsements: 0 [?]
 
0
 

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

Member Avatar
Ab000dy_85
Junior Poster in Training
69 posts since Dec 2007
Reputation Points: -3 [?]
Q&As Helped to Solve: 8 [?]
Skill Endorsements: 0 [?]
 
0
 

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

Member Avatar
nuclear
Junior Poster
105 posts since Aug 2011
Reputation Points: -9 [?]
Q&As Helped to Solve: 3 [?]
Skill Endorsements: 0 [?]
 
0
 

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.

Member Avatar
Ab000dy_85
Junior Poster in Training
69 posts since Dec 2007
Reputation Points: -3 [?]
Q&As Helped to Solve: 8 [?]
Skill Endorsements: 0 [?]
 
0
 

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.

You
This article has been dead for over three months: Start a new discussion instead
Post:
Start New Discussion
View similar articles that have also been tagged: