未定义的引用在哪里
Where is the undefined reference?
我有问题!显示此错误:
"C:UsersUserAppDataRoamingJetBrainsCLion 2018.2.4bincmakewinbincmake.exe" --build C:UsersUserCLionProjectHospitalTestcmake-build-debug --target HospitalTest -- -j 2
[ 50%] Linking CXX executable HospitalTest.exe
CMakeFilesHospitalTest.dir/objects.a(main.cpp.obj): In function `main':
C:/Users/User/CLionProject/HospitalTest/main.cpp:9: undefined reference to `CHospitalWard::CHospitalWard()'
C:/Users/User/CLionProject/HospitalTest/main.cpp:23: undefined reference to `CHospitalWard::OnAdd()'
C:/Users/User/CLionProject/HospitalTest/main.cpp:24: undefined reference to `CHospitalWard::OnDelRegNum()'
C:/Users/User/CLionProject/HospitalTest/main.cpp:25: undefined reference to `CHospitalWard::OldestPatient()'
C:/Users/User/CLionProject/HospitalTest/main.cpp:26: undefined reference to `CHospitalWard::OnPrint()'
C:/Users/User/CLionProject/HospitalTest/main.cpp:27: undefined reference to `CHospitalWard::IsInRegNum()'
collect2.exe: error: ld returned 1 exit status
mingw32-make.exe[3]: *** [CMakeFilesHospitalTest.dirbuild.make:85: HospitalTest.exe] Error 1
mingw32-make.exe[2]: *** [CMakeFilesMakefile2:72: CMakeFiles/HospitalTest.dir/all] Error 2
mingw32-make.exe[1]: *** [CMakeFilesMakefile2:84: CMakeFiles/HospitalTest.dir/rule] Error 2
mingw32-make.exe: *** [Makefile:117: HospitalTest] Error 2
代码:
///////////////////////////////
#pragma once
#include "Patient.h"
#include <string>
using namespace std;
class CHospitalWard
{
private:
string m_name;
int m_br;
CPatient *m;
public:
CHospitalWard();
CHospitalWard(string, int);
~CHospitalWard(){delete []m;}
void OnAdd();
void OnDelRegNum();
void OnPrint();
int IsInRegNum();
void OldestPatient();
string name_access() {return m_name;}
int br_access() {return m_br;}
};
有这样的声明:
cout<<"Generating..."<<endl;
CHospitalWard f;
int c;
string s;
您可能已经包含了这个文件,但还没有为这些函数编写实现。为了编译程序,您需要实现所有函数。例如,函数void DoNothing();
的最小实现是
void DoNothing() {}
相关文章:
- C++我需要了解在哪里使用指针和双指针
- 未定义的引用在哪里
- 谷歌测试中的期望值存储在哪里
- 尽管遵循了规则,内存泄漏在哪里
- 静态数据成员模板专用化的实例化点在哪里
- 在哪里放置我的函数?进入我的母语 Gui 还是进入我的演示者?
- 在哪里声明结构运算符重载
- C++ 中的自定义异常:在哪里定义它们?
- C++ 获取函数在常量引用中按值返回的结果
- 常量参数存储在哪里 (C++)?
- 如何在 c++ 中确定一条指令(以字节为单位)在哪里结束,另一条指令从哪里开始?
- 此递归函数的每次迭代的值存储在哪里?
- 如何告诉本机节点模块所需的dll存储在哪里?
- 在哪里存储跨平台C++应用存储?
- C++泛型类错误,问题出在哪里?
- 在标准中,模板参数的语法在哪里定义,例如,'std::function<int(char)>'?
- 此代码中的右值引用在哪里?
- 引用变量存储在哪里
- boost::make_shared在哪里为底层对象和引用计数对象分配内存大小
- 如何使用KDevelop查看在哪里引用空指针