Visual C++ 2005 Express Edition を使用していますが、次のリンカ エラーが発生します。
19>mylib1.lib(mylibsource1.obj) : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall std::exception::_Raise(void)const " (__imp_?_Raise@exception@std@@QBEXXZ) referenced in function "protected: static void __cdecl std::vector<class mytype,class std::allocator<class mytype> >::_Xlen(void)" (?_Xlen@?$vector@Vmytype@@V?$allocator@Vmytype@@@std@@@std@@KAXXZ)
19>mylib2.lib(mylibsource2.obj) : error LNK2001: unresolved external symbol "__declspec(dllimport) public: void __thiscall std::exception::_Raise(void)const " (__imp_?_Raise@exception@std@@QBEXXZ)
19>mylib1.lib(mylibsource1.obj) : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall std::exception::exception(char const *,int)" (__imp_??0exception@std@@QAE@PBDH@Z) referenced in function "public: __thiscall std::logic_error::logic_error(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (??0logic_error@std@@QAE@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@1@@Z)
19>mylib2.lib(mylibsource2.obj) : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall std::exception::exception(char const *,int)" (__imp_??0exception@std@@QAE@PBDH@Z)
生成されたコードで例外をオフにし、ベクター ヘッダー ファイルをインクルードする前に使用しています。
#define _HAS_EXCEPTIONS 0
いくつかのGoogleの結果はいくつかのものを示しましたが、「ああ!」はありませんでした。私のために働いた解決策。
編集:
前述のように、「_HAS_EXCEPTIONS 0」自体は例外をオフにしません。少なくともベクターヘッダーファイルでは、C++の「スロー」を呼び出す代わりに、例外オブジェクトで_Raiseを呼び出します。私の場合、正しいライブラリを含めていないため、例外オブジェクトの _Raise 関数にリンクできません。ただし、そのライブラリが何であるかは明らかではありません。