鏈接的問題我得到這些錯誤:VS2010上的ostream
1>test.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall std::basic_ofstream<char,struct std::char_traits<char> >::`vbase destructor'(void)" (__imp_??_D? [email protected][email protected]@[email protected]@@[email protected]@QAEXXZ) referenced in function _main
1>test.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall std::basic_ofstream<char,struct std::char_traits<char> >::basic_ofstream<char,struct std::char_traits<char>>(void)" ([email protected][email protected]@[email protected]@@[email protected]@[email protected]) referenced in function _main
這個測試代碼工作正常:
int main(int argc, char **argv)
{
std::ofstream game_record_output;
}
,直到我包括從舊項目從VS轉換一個.H 2003 .NET
首先,我認爲這可能與此相關的一些問題:
http://msdn.microsoft.com/en-us/library/8h8eh904(v=vs.90).aspx
但後來,我已經檢查了剛剛MSVCRT.LIB和MSVCPRT.LIB目前正在聯繫,所以舊的iostream沒有被鏈接...
我不知道爲什麼發生這種情況,我假設包含鏈中包含一些錯誤的文件,但我已經搜索舊的iostream .h文件的include鏈(即:(fstream.h,iomanip.h,ios.h,iostream.h ,istream.h,ostream.h,streamb.h和strstrea.h))
那麼,還有什麼我應該檢查?
該項目使用MFC。根據這C/C++ -> Code Generation -> Runtime Library
測試代碼看起來不完整的,順便說一句。缺少標題。 – mloskot
很抱歉的頭,如果我用這個: 的#include 它按預期工作 但是當我補充一點,我以後會需要我的依賴關係之一,它開始給它已經設置的鏈接erorrs –
Vando