老问题error LNK2005: "public: void __thiscall

// A.cpp
#include "A.h"

// A.h
#ifndef _A_H
#define _A_H
class A
{
public:
    A();
    ~A();


private:

};

A::A()
{
}

A::~A()
{
}
#endif
// test.cpp
#include "A.h"
int main(){

}

然后编译就会出现error LNK2005: "public: void __thiscall问题,当删除构造和析构函数可以通过?为什么呢?还有我通过网上说的更改运行时库还是不能编译通过,怎么办??

阅读 4.1k
1 个回答

代码有没有贴全,我在vs2015运行正常。


#include <iostream>
#include <vector>
#include <iterator>

using namespace std;

class A
{
public:
    A();
    ~A();

private:

};

A::A()
{
}

A::~A()
{
}

int main() 
{
    
    

    return 0;
}
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题