0

If I define NDEBUG in the top of my main.cpp I get all this errors:

1>  All outputs are up-to-date.
1>libcmt.lib(invarg.obj) : error LNK2005: __initp_misc_invarg already defined in LIBCMTD.lib(invarg.obj)
1>libcmt.lib(invarg.obj) : error LNK2005: __invoke_watson already defined in LIBCMTD.lib(invarg.obj)
1>libcmt.lib(invarg.obj) : error LNK2005: __set_invalid_parameter_handler already defined in LIBCMTD.lib(invarg.obj)
1>libcmt.lib(invarg.obj) : error LNK2005: __get_invalid_parameter_handler already defined in LIBCMTD.lib(invarg.obj)
1>libcmt.lib(invarg.obj) : error LNK2005: "void __cdecl _invoke_watson(unsigned short const *,unsigned short const *,unsigned short const *,unsigned int,unsigned int)" (?_invoke_watson@@YAXPBG00II@Z) already defined in LIBCMTD.lib(invarg.obj)
1>libcmt.lib(invarg.obj) : error LNK2005: __invalid_parameter already defined in LIBCMTD.lib(invarg.obj)
1>libcmt.lib(invarg.obj) : error LNK2005: "void __cdecl _invalid_parameter(unsigned short const *,unsigned short const *,unsigned short const *,unsigned int,unsigned int)" (?_invalid_parameter@@YAXPBG00II@Z) already defined in LIBCMTD.lib(invarg.obj)
1>libcmt.lib(invarg.obj) : error LNK2005: ___pInvalidArgHandler already defined in LIBCMTD.lib(invarg.obj)
1>libcpmtd.lib(xdebug.obj) : warning LNK4098: defaultlib 'libcmt.lib' conflicts with use of other libs; use /NODEFAULTLIB:library

I'm using MS Visual Studio 2010, boost and gosu libs.

Danikaze
  • 193
  • 1
  • 8

2 Answers2

1

This most likely occurs due to a mismatch between included headers (which will be release version if you define NDEBUG) and linked libraries, which appear to be debug-versions. Maybe some of the headers rely on auto-linking features, and thus you get different versions of a library linked.

Björn Pollex
  • 75,346
  • 28
  • 201
  • 283
0

This is because MSVC already defines NDEBUG for you in Release build. You shouldn't #define _DEBUG or #define NDEBUG yourself, use the pre-provided #defines.

Puppy
  • 144,682
  • 38
  • 256
  • 465