當我試圖讀取一個文件的功能C++錯誤:讀取文件時函數_main引用
void readFile(string fileName, string* anArray) {
unsigned int lineCounter = 0;
ifstream inFile = ifstream(fileName);
while (!inFile.eof()) {
string fileLine;
inFile >> fileLine;
if (!fileLine.empty()) {
anArray[lineCounter] = fileLine;
++lineCounter;
}
}
inFile.close();
}
我得到下面的錯誤,我以爲是因爲該字符串的指針數組?
1>Main.obj : error LNK2019: unresolved external symbol "void __cdecl resource::readFile(class std::basic_string,class std::allocator >,class std::basic_string,class std::allocator > *)" ([email protected]@@[email protected][email protected]@[email protected]@[email protected]@[email protected]@[email protected]@[email protected]@Z) referenced in function _main
很確定這不是完整的錯誤。 –
ups ..更新未知 – Xerath
它抱怨無法找到'resource :: readFile'的定義。它定義了哪個源文件,並鏈接到它? –