Author Topic: MSVC2005 compiler options  (Read 8171 times)

Offline sipickles

  • Multiple posting newcomer
  • *
  • Posts: 19
MSVC2005 compiler options
« on: January 04, 2008, 11:52:41 pm »
Hello,

Can anyone advise what options are useful to set for the MSVC2005 compiler? I am going around in circles.

I have linked to libs d3d9.lib and d3d9xd.lib.

I'm getting a lot of errors:

Code
-------------- Build: Debug Win32 in CLIENT ---------------

cl : Command line warning D9025 : overriding '/MDd' with '/MTd'
Framework.cpp
cl : Command line warning D9025 : overriding '/ZI' with '/Zi'
cl : Command line warning D9002 : ignoring unknown option '/O0'
C:\gamedev\VisualStudio2005\VC\include\xlocale(326) : warning C4530: C++ exception handler used, but unwind semantics are not enabled. Specify /EHsc
C:\gamedev\VisualStudio2005\VC\include\xlocale(341) : warning C4530: C++ exception handler used, but unwind semantics are not enabled. Specify /EHsc
C:\gamedev\VisualStudio2005\VC\include\xlocale(358) : warning C4530: C++ exception handler used, but unwind semantics are not enabled. Specify /EHsc

        C:\gamedev\VisualStudio2005\VC\include\ostream(137) : while compiling class template member function 'void std::basic_ostream<_Elem,_Traits>::_Osfx(void)'
        with
        [
            _Elem=char,
            _Traits=std::char_traits<char>
        ]
C:\gamedev\VisualStudio2005\VC\include\ostream(138) : warning C4530: C++ exception handler used, but unwind semantics are not enabled. Specify /EHsc
        C:\gamedev\VisualStudio2005\VC\include\ostream(137) : while compiling class template member function 'void std::basic_ostream<_Elem,_Traits>::_Osfx(void)'
        with
        [
            _Elem=wchar_t,
            _Traits=std::char_traits<wchar_t>
        ]
C:\gamedev\VisualStudio2005\VC\include\xstring(1971) : warning C4530: C++ exception handler used, but unwind semantics are not enabled. Specify /EHsc
        C:\gamedev\VisualStudio2005\VC\include\xstring(1962) : while compiling class template member function 'void std::basic_string<_Elem,_Traits,_Ax>::_Copy(unsigned int,unsigned int)'
        with
        [
            _Elem=char,
            _Traits=std::char_traits<char>,
            _Ax=std::allocator<char>
        ]
        C:\gamedev\VisualStudio2005\VC\include\stdexcept(48) : see reference to class template instantiation 'std::basic_string<_Elem,_Traits,_Ax>' being compiled
        with
        [
            _Elem=char,
            _Traits=std::char_traits<char>,
            _Ax=std::allocator<char>
        ]
C:\gamedev\VisualStudio2005\VC\include\xstring(1971) : warning C4530: C++ exception handler used, but unwind semantics are not enabled. Specify /EHsc
        C:\gamedev\VisualStudio2005\VC\include\xstring(1962) : while compiling class template member function 'void std::basic_string<_Elem,_Traits,_Ax>::_Copy(unsigned int,unsigned int)'
        with
        [
            _Elem=char,
            _Traits=std::char_traits<char>,
            _Ax=std::_DebugHeapAllocator<char>
        ]
        C:\gamedev\VisualStudio2005\VC\include\xdebug(111) : see reference to class template instantiation 'std::basic_string<_Elem,_Traits,_Ax>' being compiled
        with
        [
            _Elem=char,
            _Traits=std::char_traits<char>,
            _Ax=std::_DebugHeapAllocator<char>
        ]
Linking executable: CLIENT.exe
msvcprtd.lib(MSVCP80D.dll) : error LNK2005: "public: __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::~basic_string<char,struct std::char_traits<char>,class std::allocator<char> >(void)" (??1?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@XZ) already defined in Framework.obj
msvcprtd.lib(MSVCP80D.dll) : error LNK2005: "public: class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > & __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::append(char const *)" (?append@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEAAV12@PBD@Z) already defined in Framework.obj
msvcprtd.lib(MSVCP80D.dll) : error LNK2005: "public: __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (??0?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@ABV01@@Z) already defined in libcpmtd.lib(string.obj)
msvcprtd.lib(MSVCP80D.dll) : error LNK2005: "public: char const * __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::c_str(void)const " (?c_str@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBEPBDXZ) already defined in Framework.obj
msvcprtd.lib(MSVCP80D.dll) : error LNK2005: "public: __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >(char const *)" (??0?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@PBD@Z) already defined in Framework.obj
MSVCRTD.lib(MSVCR80D.dll) : error LNK2005: _fopen_s already defined in LIBCMTD.lib(fopen.obj)
MSVCRTD.lib(MSVCR80D.dll) : error LNK2005: _fclose already defined in LIBCMTD.lib(fclose.obj)
MSVCRTD.lib(MSVCR80D.dll) : error LNK2005: _fwrite already defined in LIBCMTD.lib(fwrite.obj)
MSVCRTD.lib(MSVCR80D.dll) : error LNK2005: _strcpy_s already defined in LIBCMTD.lib(strcpy_s.obj)
MSVCRTD.lib(MSVCR80D.dll) : error LNK2005: _sprintf_s already defined in LIBCMTD.lib(sprintf.obj)
MSVCRTD.lib(MSVCR80D.dll) : error LNK2005: _vsprintf_s already defined in LIBCMTD.lib(vsnprnc.obj)
MSVCRTD.lib(MSVCR80D.dll) : error LNK2005: _strcat_s already defined in LIBCMTD.lib(strcat_s.obj)
MSVCRTD.lib(ti_inst.obj) : error LNK2005: "private: __thiscall type_info::type_info(class type_info const &)" (??0type_info@@AAE@ABV0@@Z) already defined in LIBCMTD.lib(typinfo.obj)
MSVCRTD.lib(ti_inst.obj) : error LNK2005: "private: class type_info & __thiscall type_info::operator=(class type_info const &)" (??4type_info@@AAEAAV0@ABV0@@Z) already defined in LIBCMTD.lib(typinfo.obj)
LINK : warning LNK4098: defaultlib 'MSVCRTD' conflicts with use of other libs; use /NODEFAULTLIB:library
Framework.obj : error LNK2019: unresolved external symbol __imp__CreateWindowExA@48 referenced in function "public: bool __thiscall CFramework::Create(struct HINSTANCE__ *)" (?Create@CFramework@@QAE_NPAUHINSTANCE__@@@Z)
Framework.obj : error LNK2019: unresolved external symbol __imp__AdjustWindowRect@12 referenced in function "public: bool __thiscall CFramework::Create(struct HINSTANCE__ *)" (?Create@CFramework@@QAE_NPAUHINSTANCE__@@@Z)
Framework.obj : error LNK2019: unresolved external symbol __imp__RegisterClassExA@4 referenced in function "public: bool __thiscall CFramework::Create(struct HINSTANCE__ *)" (?Create@CFramework@@QAE_NPAUHINSTANCE__@@@Z)
Framework.obj : error LNK2019: unresolved external symbol __imp__LoadIconA@8 referenced in function "public: bool __thiscall CFramework::Create(struct HINSTANCE__ *)" (?Create@CFramework@@QAE_NPAUHINSTANCE__@@@Z)
Framework.obj : error LNK2019: unresolved external symbol __imp__LoadCursorA@8 referenced in function "public: bool __thiscall CFramework::Create(struct HINSTANCE__ *)" (?Create@CFramework@@QAE_NPAUHINSTANCE__@@@Z)
Framework.obj : error LNK2019: unresolved external symbol __imp__PostQuitMessage@4 referenced in function "public: bool __thiscall CFramework::Create(struct HINSTANCE__ *)" (?Create@CFramework@@QAE_NPAUHINSTANCE__@@@Z)
CLIENT.obj : error LNK2001: unresolved external symbol __imp__PostQuitMessage@4
Framework.obj : error LNK2019: unresolved external symbol __imp__MessageBoxA@16 referenced in function "public: bool __thiscall CFramework::Create(struct HINSTANCE__ *)" (?Create@CFramework@@QAE_NPAUHINSTANCE__@@@Z)
DirectInput.lib(DirectInput.obj) : error LNK2001: unresolved external symbol __imp__MessageBoxA@16
Framework.obj : error LNK2019: unresolved external symbol __imp__ShowWindow@8 referenced in function "public: bool __thiscall CFramework::RestoreDevice(bool)" (?RestoreDevice@CFramework@@QAE_N_N@Z)
CLIENT.obj : error LNK2001: unresolved external symbol __imp__ShowWindow@8
Framework.obj : error LNK2019: unresolved external symbol __imp__SetWindowPos@28 referenced in function "public: bool __thiscall CFramework::RestoreDevice(bool)" (?RestoreDevice@CFramework@@QAE_N_N@Z)
Framework.obj : error LNK2019: unresolved external symbol __imp__SetWindowLongA@12 referenced in function "public: bool __thiscall CFramework::RestoreDevice(bool)" (?RestoreDevice@CFramework@@QAE_N_N@Z)
Framework.obj : error LNK2019: unresolved external symbol __imp__DispatchMessageA@4 referenced in function "public: bool __thiscall CFramework::MsgProc(void)" (?MsgProc@CFramework@@QAE_NXZ)
Framework.obj : error LNK2019: unresolved external symbol __imp__TranslateMessage@4 referenced in function "public: bool __thiscall CFramework::MsgProc(void)" (?MsgProc@CFramework@@QAE_NXZ)
Framework.obj : error LNK2019: unresolved external symbol __imp__TranslateAcceleratorA@12 referenced in function "public: bool __thiscall CFramework::MsgProc(void)" (?MsgProc@CFramework@@QAE_NXZ)
Framework.obj : error LNK2019: unresolved external symbol __imp__PeekMessageA@20 referenced in function "public: bool __thiscall CFramework::MsgProc(void)" (?MsgProc@CFramework@@QAE_NXZ)
Framework.obj : error LNK2019: unresolved external symbol "void __cdecl boost::throw_exception(class std::exception const &)" (?throw_exception@boost@@YAXABVexception@std@@@Z) referenced in function "public: __thiscall boost::detail::shared_count::shared_count<class CDisplaySettings>(class CDisplaySettings *)" (??$?0VCDisplaySettings@@@shared_count@detail@boost@@QAE@PAVCDisplaySettings@@@Z)
CLIENT.obj : error LNK2001: unresolved external symbol "void __cdecl boost::throw_exception(class std::exception const &)" (?throw_exception@boost@@YAXABVexception@std@@@Z)
CLIENT.obj : error LNK2019: unresolved external symbol __imp__CoUninitialize@0 referenced in function _WinMain@16
CLIENT.obj : error LNK2019: unresolved external symbol __imp__UpdateWindow@4 referenced in function _WinMain@16
CLIENT.obj : error LNK2019: unresolved external symbol __imp__CoInitializeEx@8 referenced in function _WinMain@16
CLIENT.obj : error LNK2019: unresolved external symbol __imp__DefWindowProcA@16 referenced in function "long __stdcall WindowProc(struct HWND__ *,unsigned int,unsigned int,long)" (?WindowProc@@YGJPAUHWND__@@IIJ@Z)
CLIENT.exe : fatal error LNK1120: 19 unresolved externals
Process terminated with status 1120 (0 minutes, 6 seconds)
38 errors, 25 warnings
 

Offline darthdespotism

  • Almost regular
  • **
  • Posts: 163
    • Coder's Nemesis
Re: MSVC2005 compiler options
« Reply #1 on: January 05, 2008, 10:50:36 am »
Looks like you link the standard library twice.

LINK : warning LNK4098: defaultlib 'MSVCRTD' conflicts with use of other libs; use /NODEFAULTLIB:library