4
我寫了一個程序,當相應的分隔符發生時分割字符串。但是,不同的錯誤發生,如:錯誤:LNK 2019:無法解析的外部符號_imp_CrtDbgReportw在Visual Studio中
Error 1 error LNK2019: unresolved external symbol __imp___CrtDbgReportW referenced in function "public: char const & __thiscall std::_String_const_iterator<class std::_String_val<struct std::_Simple_types<char> > >::operator*(void)const " ([email protected][email protected][email protected]@[email protected]@@[email protected]@@[email protected]@QBEABDXZ) Source.cpp Using Object_Type Input
我開發的C++測試相同的程序,它工作正常,但在Visual Studio這些類型的問題正在提高。
我的計劃:
#include <string>
#include <iostream>
#include<tchar.h>
using namespace std;
#pragma comment (lib, "ws2_32.lib")
int _tmain(int argc, _TCHAR* argv[])
{
string s = "Enter a line of text,\n next line\n as the\n delimiter: ";
string delimiter = "\n";
size_t pos = 0;
string token;
while ((pos = s.find(delimiter)) != std::string::npos) {
token = s.substr(0, pos);
std::cout << token << std::endl;
s.erase(0, pos + delimiter.length());
}
std::cout << s << std::endl;
return 0;
}
我甚至嘗試刪除頁眉和更改main()函數爲int main()和INT主要(無效)。但在Visual Studio中發生同樣的錯誤。請任何人幫助我。
謝謝。我將運行時間庫改爲MTd。有效。 –