Visual Studio 2010 C++ Release Mode Issue - visual-studio-2010

I am trying to compile my c++ project in visual studio 2010, that has been running fine in debug mode for the past several months. I am finished developing it, so I would like to create an exe to release.
The issue is that I am receiving a bunch of compiler errors when I switch it to release mode that I am not sure how to debug.
Any help would be appreciated:
1>main.obj : error LNK2005: "int __cdecl initKinect(void)" (?initKinect##YAHXZ) already defined in gui.obj
1>main.obj : error LNK2005: _main already defined in gui.obj
1>Kinect.lib(Kinect-win32.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '2' doesn't match value '0' in algorithm.obj
1>Kinect.lib(Kinect-win32.obj) : warning LNK4075: ignoring '/EDITANDCONTINUE' due to '/OPT:ICF' specification
1>Kinect.lib(Kinect-Driver.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '2' doesn't match value '0' in algorithm.obj
1>Kinect.lib(Kinect-FrameInput.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '2' doesn't match value '0' in algorithm.obj
1>libcpmtd.lib(stdthrow.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '2' doesn't match value '0' in algorithm.obj
1>LIBCMTD.lib(dbgheap.obj) : error LNK2005: __heap_alloc already defined in LIBCMT.lib(malloc.obj)
1>LIBCMTD.lib(dbgheap.obj) : error LNK2005: __recalloc already defined in LIBCMT.lib(recalloc.obj)
1>LIBCMTD.lib(dbgheap.obj) : error LNK2005: __msize already defined in LIBCMT.lib(msize.obj)
1>LIBCMTD.lib(dbghook.obj) : error LNK2005: __crt_debugger_hook already defined in LIBCMT.lib(dbghook.obj)
1>LIBCMTD.lib(isctype.obj) : error LNK2005: __isctype_l already defined in LIBCMT.lib(isctype.obj)
1>LIBCMTD.lib(isctype.obj) : error LNK2005: __isctype already defined in LIBCMT.lib(isctype.obj)
1>LINK : warning LNK4098: defaultlib 'LIBCMTD' conflicts with use of other libs; use /NODEFAULTLIB:library
1>C:\Users\Tom\Documents\Kinect\repository\KinectTracker\Release\KinectTracker.exe : fatal error LNK1169: one or more multiply defined symbols found
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

This looks to me like you are linking two sets of libraries (besides possible other problems). Libcmtd is multithreaded-debug version of libc, and libcmt is release version of same thing.

Related

how to convert a linux cmake into windows vs?

i download a linux cmake project which i will use in the windows vs.what i do is that i create a new win32 project in vs and add all .h an .cpp file to the new project,and then,i config the third library dependence of Boost.but,there are some errors when i debug this project,the error details is as follows.
> Generating Code...
1>main.obj : error LNK2005: "struct boost::arg<1> & ibeo::placeholders::ew" (?ew#placeholders#ibeo##3AAU?$arg#$00#boost##A) already defined in libibeo.obj
1>main.obj : error LNK2005: "struct boost::arg<1> & ibeo::placeholders::points" (?points#placeholders#ibeo##3AAU?$arg#$00#boost##A) already defined in libibeo.obj
1>main.obj : error LNK2005: "struct boost::arg<1> & ibeo::placeholders::objects" (?objects#placeholders#ibeo##3AAU?$arg#$00#boost##A) already defined in libibeo.obj
1>LINK : fatal error LNK1104: cannot open file 'libboost_system-vc110-mt-gd-1_63.lib'
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

using libcurl with chilkat getting errors

i'm using chilkat and libcurl in same project when i build the project with
Runtime Library => Multi-threaded DLL (/MD)
then i get these errors and warning:
Error 4 error LNK1169: one or more multiply defined symbols found
Error 1 error LNK2005: __invoke_watson already defined in MSVCRT.lib(MSVCR90.dll)
Error 2 error LNK2005: __strdup already defined in LIBCMT.lib(strdup.obj)
Warning 3 warning LNK4098: defaultlib 'LIBCMT' conflicts with use of other libs; use /NODEFAULTLIB:library
and when build with
Runtime Library => Multi-threaded (/MT)
Error 54 error LNK1169: one or more multiply defined symbols found
Error 44 error LNK2005: "private: __thiscall type_info::type_info(class type_info const &)" (??0type_info##AAE#ABV0##Z) already defined in LIBCMT.lib(typinfo.obj)
Error 45 error LNK2005: "private: class type_info & __thiscall type_info::operator=(class type_info const &)" (??4type_info##AAEAAV0#ABV0##Z) already defined in LIBCMT.lib(typinfo.obj)
Error 11 error LNK2005: ___iob_func already defined in LIBCMT.lib(_file.obj)
Error 39 error LNK2005: __beginthreadex already defined in LIBCMT.lib(threadex.obj)
Error 47 error LNK2005: __close already defined in LIBCMT.lib(close.obj)
...
Chilkat offers both "Multithread DLL" and "Multithread" (i.e. static) libs. Make sure you link with ChilkatRelDll.lib instead of ChilkatRel.lib
Chilkat offers both "Multithread DLL" and "Multithread" (i.e. static) libs. Make sure you link with ChilkatRelDll.lib instead of ChilkatRel.lib
This error occurred due to linking ChilkatRel.lib in Multithread DLL Runtime Project which occurs same lib file more than one time, which occurred multiple definitions of a function. these symbols are present in libcmt.lib
You can resolve this problem by using Runtime Library as Multi-threaded DLL (/MD) and
Adding "libcmt.lib" to the "Ignore Specific Library" field doesn't get me past this problem.

Fatal error (1017) invalid integer constant expression in ctype.h during migration from VS6 to VS5

While migrating VC++ code from VS6 (1998) to VS5(later year) I had to remove __STDC__ from project properties->Preprocessors. It fix lot of 'tagVariant' related errors.
Next what happened is function definitions were not recognized in many of the project file.
so I added #define __STDC__ in problem files which also took care of many unrecognized function definition related errors.
Now the project is left with only one error in compiling one file which says
"Fetal error (1017) invalid integer constant expression in ctype.h" and the code its pointing to line number 362 in ctype.h #define !__STDC__ etc
Any ideas - suggestions ?
I tried to - Remove any #define __STDC__ that you added locally. Also remove __STDC__ from Preprocessor definitions if you haven't done so already.
Select all the .c files in the solution explorer and select properties in the solution explorer context menu. In the properties dialog select /Za for C/C++\Language\Disable Language Extensions property.
Which took me back to ->
error C2065: ‘xyz’: undeclared identifier
: error C2182: ‘pqr’ : illegal use of type 'void'
: error C2065: ‘some variable’ : undeclared identifier
: error C2146: syntax error : missing ';' before identifier ‘classname’
: error C2143: syntax error : missing ';' before '*'
: error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
: error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
: error C2040: ‘variable2’ : 'int *' differs in levels of indirection from ''unknown-type''
.
.
.
all the errors are in my files.
Reference :
http://social.msdn.microsoft.com/Forums/en-US/e68b0af5-ed25-4953-80e7-e88463149b77/fatal-error-1017-invalid-integer-constant-expression-in-ctypeh-during-migration-from-vs6-to-vs5?forum=vcgeneral
Wow...I could compile the project. Big Grin | :-D I do have lot of LINK errors but I will work on it.
I learnt this "Use precompiled headers ("#include "). This must be the first include in your .cpp file."
Changed the sequence of the .h files and I am all set now.

Visual Studio - error LNK2005 in debug mode

I'm integrating 3rd party code into my MFC app under Visual Studio 2010.When in Debug mode the following build error occurs:
1>LIBCMT.lib(invarg.obj) : error LNK2005: __initp_misc_invarg already defined in libcmtd.lib(invarg.obj)
1>LIBCMT.lib(invarg.obj) : error LNK2005: __call_reportfault 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: __invoke_watson 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>LINK : warning LNK4098: defaultlib 'LIBCMT' conflicts with use of other libs; use /NODEFAULTLIB:library
1>D:\My Documents\Dev\MyProject\MyProject\Debug\MyProject.exe : fatal error LNK1169: one or more multiply defined symbols found
Using this advice I was able to complete the build in two ways:
In Release mode
In Debug mode using /FORCE:MULTIPLE as an additional linker command line option
In the second case (Debug mode) many warnings are still reported. If I also add /NODEFAULTLIB:LIBCMT most of them are gone.
What is the cause of this?
How can I solve this, instead of working around it?
For some reason, you're linking against both LIBCMT and LIBCMTD (the debug version). (From reading the end of each error line: already defined in libcmtd.lib(invarg.obj))
You're fixing the right thing by saying /NODEFAULTLIB:LIBCMT. Does the debug/release flag on the third-party library that you're linking against match the debug/release mode on your app build? I would guess that the third-party code is pulling in a redundant library somehow.
If you're lucky, your 3rd party package contains a xxx.lib as well as a xxxD.lib, like for LIBCMT. Then you would just have to link the appropriate one according to release/debug.
Worked for me in a similar case.
I resolved the same problem this way:
In the Solution Explorer > Configuration Parameters > C/C++ > Code Generation.
In the Runtime Library field, select.... for my "3rd party code" I had to select Multi-threaded (/MTd) and it worked.

Chromium Build Fails on Windows

I am attempting to build Chromium for windows (using Visual Studio 2008 SP1) and it fails with about 37 errors. Here's a selection:
Error 1 error LNK2005: "wchar_t const * const switches::kProcessChannelID" (?kProcessChannelID#switches##3QB_WB) already defined in ipc.lib(ipc_switches.obj) common.lib chrome_dll
Error 2 error LNK2005: "wchar_t const * const switches::kDebugChildren" (?kDebugChildren#switches##3QB_WB) already defined in ipc.lib(ipc_switches.obj) common.lib chrome_dll
Error 3 error LNK2005: "wchar_t const * const switches::kIPCUseFIFO" (?kIPCUseFIFO#switches##3QB_WB) already defined in ipc.lib(ipc_switches.obj) common.lib chrome_dll
Error 4 fatal error LNK1169: one or more multiply defined symbols found C:\Users\RCIX\src\chrome\Debug\chrome.dll 1 chrome_dll
Those errors are the only type of errors that how up but they pop up in about half a dozen projects. What did i do wrong?
It means that the symbols are defined in two places; ipc.lib (via ipc_switches.obj) and common.lib. I am not familiar with Chromium at all, but I would guess that common.lib incorporates ipc.lib and the chrome_dll project is trying to link to both libs. Try removing ipc.lib from the linker inputs.

Resources