We're a community of 1077K IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,076,018 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

Visual c++ linking errors

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.

2
Contributors
5
Replies
20 Hours
Discussion Span
1 Year Ago
Last Updated
6
Views
nuclear
Junior Poster
105 posts since Aug 2011
Reputation Points: 2
Solved Threads: 3
Skill Endorsements: 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

Ab000dy_85
Junior Poster in Training
68 posts since Dec 2007
Reputation Points: 7
Solved Threads: 6
Skill Endorsements: 0

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

nuclear
Junior Poster
105 posts since Aug 2011
Reputation Points: 2
Solved Threads: 3
Skill Endorsements: 0

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

Ab000dy_85
Junior Poster in Training
68 posts since Dec 2007
Reputation Points: 7
Solved Threads: 6
Skill Endorsements: 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.

nuclear
Junior Poster
105 posts since Aug 2011
Reputation Points: 2
Solved Threads: 3
Skill Endorsements: 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.

Ab000dy_85
Junior Poster in Training
68 posts since Dec 2007
Reputation Points: 7
Solved Threads: 6
Skill Endorsements: 0

This article has been dead for over three months: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
View similar articles that have also been tagged:
 
© 2013 DaniWeb® LLC
Page rendered in 0.1029 seconds using 2.67MB