我收到这些错误消息:
错误1错误LNK2019:未解决
外部符号“public:void
__thiscall ArrayIntStorage::sortOwn(void)"
(?sortOwn@ArrayIntStorage@@QAEXXZ)
函数中引用
_main G:\08227\ACW\MAIN\08227_ACW2_Test_Harnesses_2010-11\C_Style_Array\main.obj C_Style_Array
错误2错误LNK2019:未解决
外部符号“public:void
__thiscall ArrayIntStorage::sortStd(void)"
(?sortStd@ArrayIntStorage@@QAEXXZ)
函数中引用
_main G:\08227\ACW\MAIN\08227_ACW2_Test_Harnesses_2010-11\C_Style_Array\main.obj C_Style_Array
错误 3 错误 LNK2019:未解决
外部符号“类
std::basic_ostream > & __cdecl
运算符 &,类
ArrayIntStorage const &)"
(??6@YAAAV?$basic_ostream@DU?$char_traits@D@std@@@std@@AAV01@ABVArrayIntStorage@@@Z)
函数中引用
_main G:\08227\ACW\MAIN\08227_ACW2_Test_Harnesses_2010-11\C_Style_Array\main.obj C_Style_Array
错误 4 错误 LNK2019:未解决
外部符号“类
std::basic_istream > & __cdecl
运算符>>(类
std::basic_istream > &,类
ArrayIntStorage &)"
(??5@YAAAV?$basic_istream@DU?$char_traits@D@std@@@std@@AAV01@AAVArrayIntStorage@@@Z)
函数中引用
_main G:\08227\ACW\MAIN\08227_ACW2_Test_Harnesses_2010-11\C_Style_Array\main.obj C_Style_Array
错误5错误LNK2019:未解决
外部符号“public: bool
__thiscall ArrayIntStorage::setReadSort(bool)"
(?setReadSort@ArrayIntStorage@@QAE_N_N@Z)
函数中引用
_main G:\08227\ACW\MAIN\08227_ACW2_Test_Harnesses_2010-11\C_Style_Array\main.obj C_Style_Array
错误 6 错误 LNK1120:5 未解决
外部 G:\08227\ACW\MAIN\08227_ACW2_Test_Harnesses_2010-11\C_Style_Array\Debug\C_Style_Array.exe 1 1 C_Style_Array
我不知道发生了什么,我想知道我是否错过了什么?
我对此很陌生,它没有给我任何行号,所以我不确定要给你哪个代码,所以我会给你这部分
#include <fstream>
#include <iostream>
using namespace std;
#include "ArrayIntStorage.h"
int main(int argc, char **argv) {
ifstream fin1("ACW2_data.txt");
ofstream out1("1-arrayUnsortedRead.txt");
ofstream out2("2-arrayUnsortedRead-thenSTDSort.txt");
if(!fin1.is_open())
{
cout << "FAIL" << endl;
return 1;
}
ArrayIntStorage arrayStorage1;
arrayStorage1.setReadSort(false); // do not read sort
// read in int values into data structure
fin1 >> arrayStorage1;
// output int values in data structure to file
out1 << arrayStorage1;
// sort data structure using std
arrayStorage1.sortStd();
// output int values in data structure to file
out2 << arrayStorage1;
fin1.close();
out1.close();
out2.close();
您的链接器(编译器的一部分)找不到位置ArrayIntStorage::sortOwn()
被定义为。
这通常发生在:
- 的定义
ArrayIntStorage::sortOwn()
位于另一个 .c 文件中,您忘记告诉编译器(因此未编译),
- ArrayIntStorage 是一个仅包含头文件的库(因此没有其他 .c 文件),在这种情况下您可能忘记了实现该函数
sortOwn()
,并且只是声明了这一点。
- ArrayIntStorage 是一个尚未链接的外部库。 (如 Tomalak Geretkal 注释,并通过遵循 paxdiablo 规定的步骤解决)
如果这两者都不是,或者您发现这些选项令人困惑,请发布头文件ArrayIntStorage.h
以及相应的 .c 文件(如果有的话)。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)