3

I'm trying to compile my game with Visual Studio 2013. The game uses Box2D, but when compiling in Release mode the release Box2D.lib is giving errors. It works fine when compiling in Debug mode with the debug Box2D.lib.

I'm getting 135 errors, and mainly something like these three:

1>Box2D.lib(b2CollideEdge.obj) : error LNK2001: unresolved external symbol @__security_check_cookie@4
1>MyContactListener.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) char const * __cdecl std::_Winerror_map(int)"
(__imp_?_Winerror_map@std@@YAPBDH@Z)
1>Box2D.lib(b2ContactManager.obj) : error LNK2001: unresolved external symbol _atexit

I have built the Box2D.lib's several times now, and I'm sure I'm linking to the right release and debug libraries.

I tried disabling the compiler flag /GS (Buffer Security Check), but that didn't help.

For building the Box2D.lib and when compiling the game I use the flag Multi-threaded DLL (/MD) for runtime library.

EDIT: I got rid of the errors "@__security_check_cookie@4" when I linked with the library "bufferoverflowU.lib". Still, 133 errors remain.

lefti
  • 268
  • 4
  • 13
  • 1
    The Box2D library you are using may have been compiled with an older version of Visual Studio. – Captain Obvlious Dec 02 '14 at 15:10
  • 1
    @Captain Obvlious: I'm certain the Box2D library is compiled with the same version of VS I'm compiling the game in. Actually I compiled the library 20 minutes ago the last time. – lefti Dec 02 '14 at 15:14
  • These are all C runtime library symbols, specific to the Microsoft version. How you managed to avoid linking it is impossible to guess. Show the linker options you use. – Hans Passant Dec 02 '14 at 17:42
  • @Hans Passant: Should I just copy-paste the options from "Properties -> Linker -> Command Line"? – lefti Dec 02 '14 at 17:46

1 Answers1

1

You probably disabled linking of default run-time libraries in linker options. Right-click on the project and go to properties. Under Linker->Input set an option Ignore All Default Libraries to No.

Marian Spanik
  • 1,079
  • 1
  • 12
  • 18