2012-02-07 15 views
1

OpenCVライブラリに静的にリンクされているwin32アプリケーションをビルドしています。ビルドログ内のようなstringstreamとのリンクエラー

"LIBCMTD.lib(sprintf.obj) : error LNK2005: _sprintf already defined in MSVCRTD.lib(MSVCR100D.dll)" 

最後の2つの文であったリンクエラーの多くがたくさんあったとして最初の試行時に、私は、デフォルトのライブラリ、MSVCPRTD.LIBとlibcmtd.libを無視するようにビルドログで指示されました

error LNK2001: unresolved external symbol "__declspec(dllimport) class std::basic_ostream<char,struct std::char_traits<char> > std::cout" ([email protected]@@[email protected][email protected]@[email protected]@@[email protected]) 
1>run.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: virtual __thiscall std::basic_iostream<char,struct std::char_traits<char> >::~basic_iostream<char,struct std::char_traits<char> >(void)" ([email protected][email protected]@[email protected]@@[email protected]@[email protected]) referenced in function [email protected][email protected]@[email protected]@[email protected]@[email protected]@[email protected]@[email protected]@Z$0 
1>run.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall std::basic_iostream<char,struct std::char_traits<char> >::basic_iostream<char,struct std::char_traits<char> >(class std::basic_streambuf<char,struct std::char_traits<char> > *)" ([email protected][email protected]@[email protected]@@[email protected]@[email protected][email protected][email protected]@[email protected]@@[email protected]@Z) referenced in function "public: __thiscall std::basic_stringstream<char,struct std::char_traits<char>,class std::allocator<char> >::basic_stringstream<char,struct std::char_traits<char>,class std::allocator<char> >(int)" ([email protected][email protected]@[email protected]@[email protected]@[email protected]@[email protected]@[email protected]@Z) 
1>run.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) protected: void __thiscall std::basic_streambuf<char,struct std::char_traits<char> >::setp(char *,char *,char *)" ([email protected][email protected][email protected]@[email protected]@@[email protected]@[email protected]) referenced in function "protected: virtual int __thiscall std::basic_stringbuf<char,struct std::char_traits<char>,class std::allocator<char> >::overflow(int)" ([email protected][email protected][email protected]@[email protected]@[email protected]@[email protected]@[email protected]@[email protected]) 
1>run.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) protected: char * __thiscall std::basic_streambuf<char,struct std::char_traits<char> >::pbase(void)const " ([email protected][email protected][email protected]@[email protected]@@[email protected]@IBEPADXZ) referenced in function "protected: virtual int __thiscall std::basic_stringbuf<char,struct std::char_traits<char>,class std::allocator<char> >::overflow(int)" ([email protected][email protected][email protected]@[email protected]@[email protected]@[email protected]@[email protected]@[email protected]) 

誰でも同様のエラーが発生した:私はこれらの2つのライブラリを除外した後

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

は、私は、次のビルドエラーが出るようにstringstreamやCOUTを使用することはできませんよ?

+0

OpenCV静的ライブラリのようなサウンドは、別のMSVSランタイムとリンクするために作成されました。あなたはリリースノートを読んだことがありますか? –

+1

参照:フォーマットのヘルプについては、http://stackoverflow.com/editing-helpをご覧ください。 –

答えて

0

Visual StudioがMSVCRTD.libLIBCMTD.libの間の競合について不平を言うときはいつも、Microsftランタイム要素で一貫してリンクしていないプロジェクトを一緒にリンクしていることが確かです。

あなたは、使用しているOpenCVが静的にリンクされていると述べました。あなたのプロジェクトが動的にリンクされていると思います。すべてのプロジェクトを静的にリンクするか、すべてのプロジェクトを動的にリンクするように、ソリューションファイルをセットアップする必要があります。