2013-06-28 35 views
0

我有一個相當不尋常的問題。我試圖做到這一點:從std :: cin讀取會產生鏈接器錯誤

char *content = new char[10000]; 
std::cin.read(content, 10000); 

我得到下面的連接錯誤(奇怪,因爲該代碼是在幾個星期前編制精細,並沒有被修改):

Error LNK2001: unresolved external symbol "__declspec(dllimport) public: class std::basic_istream<char,struct std::char_traits<char> > & __thiscall std::basic_istream<char,struct std::char_traits<char> >::read(char *,__int64)" ([email protected][email protected][email protected]@[email protected]@@[email protected]@[email protected][email protected]) main.obj 

我證實我擁有項目屬性中鏈接的所有必需依賴項,驗證了我有/ MT設置等。該項目幾周前正在編譯 - 我在當前和現在完成的唯一一件事是更新VS2012。這裏是我的包括。

#include <stdlib.h> 

#ifdef _WIN32 
    #include <process.h> 
#else 
    #include <unistd.h> 
    extern char ** environ; 
#endif 

#include "fcgio.h" 
#include "fcgi_config.h" 

#include <boost/filesystem.hpp> 
#include <boost/filesystem/fstream.hpp> 
#include <boost/algorithm/string.hpp> 
+0

檢查項目設置以查看它是否被配置爲忽略默認庫。 –

+0

據我所見,你的包含不包含'iostream'。要麼是這樣,要麼你使用'gcc'而不是'g ++'來編譯你的代碼。 –

+0

你的文件是否以'.c'結尾。看起來好像C編譯器已經被調用來編譯你的程序。 –

回答

0

似乎在更新Visual Studio 2012之後,項目(以某種方式)變得無法使用。將完全相同的代碼複製到新項目已解決該問題。