200字范文,内容丰富有趣,生活中的好帮手!
200字范文 > c语言找到一个或多个多重定义符号 error LNK: “找到一个或多个多重定义的符号

c语言找到一个或多个多重定义符号 error LNK: “找到一个或多个多重定义的符号

时间:2020-04-15 01:53:50

相关推荐

c语言找到一个或多个多重定义符号 error LNK: “找到一个或多个多重定义的符号

1 问题还原

这里我有三个源文件:Base.hpp, Base.cpp 和 main.cpp

在Base.hpp里面定义一个基类,注意,基类只包含构造函数和析构函数的声明,函数在Base.cpp里实现。

此外在Base.hpp中还有一个函数的定义(函数声明和定义都在Base.hpp文件中)三个文件代码如下。

Base.hpp

#ifndef VIRTUAL_H

#define VIRTUAL_H

#include

#include

using namespace std;

class Base{

public:

Base();

~Base();

private:

char *p;

};

void platform(Base *pBase){

cout << "this is just a function..." << endl;

}

#endif

Base.cpp

#include"Base.hpp"

Base::Base(){

cout << "construction function..." << endl;

}

Base::~Base(){

cout << "destructor function..." << endl;

delete p;

}

main.cpp

#include"

c语言找到一个或多个多重定义符号 error LNK: “找到一个或多个多重定义的符号” 已经在 xxxx.obj 中定义 的解决方法...

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。