Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/oop/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ 无法将字符串参数传递给派生类成员函数c++;_C++_Oop_Inheritance - Fatal编程技术网

C++ 无法将字符串参数传递给派生类成员函数c++;

C++ 无法将字符串参数传递给派生类成员函数c++;,c++,oop,inheritance,C++,Oop,Inheritance,main.cpp文件中包含以下内容: string password; string temp_password; archiveObj.checkPassword(password,temp_password); “checkPassword”的声明在派生类“Archive”中,如下所示: string checkPassword(string,string); 但是,当我在Visual Studio Express 2010中运行代码时,出现以下错误: 错误1错误LNK2001:未解析

main.cpp文件中包含以下内容:

string password;
string temp_password;

archiveObj.checkPassword(password,temp_password);
“checkPassword”的声明在派生类“Archive”中,如下所示:

string checkPassword(string,string);
但是,当我在Visual Studio Express 2010中运行代码时,出现以下错误:

错误1错误LNK2001:未解析的外部符号“public:class std::basic_string,class std::allocator>\uu thiscall Archive::checkPassword(class std::basic_string,class std::allocator>&,class std::basic_string,class std::allocator>&)”(?checkPassword@Archive@@QAE?AV?$basic_string@DU?$char_traits@D@性病病毒$allocator@D@2@@std@@AAV23@0@Z)C:\Users\HP\documents\visualstudio 2010\Projects\Room def\Room def\Main.obj


有人能帮我解决这个问题吗?

您收到的消息来自链接器,链接器正在抱怨,因为它找不到
checkPassword()
的目标代码


可能您忘记提供该函数的定义(您有一个声明,但您没有显示该函数是否也已定义),或者您忘记链接
.cpp
文件,其中给出了
checkPassword()
的定义。

是的,我忘记在函数定义前面包含Archive::的内容,谢谢你,安迪Prowl@EhsanMamakani:我想是的如果这回答了你的问题,请考虑将答案标记为被允许时: