c++ - 老问题error LNK2005: "public: void __thiscall

查看:232
本文介绍了c++ - 老问题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问题,当删除构造和析构函数可以通过?为什么呢?还有我通过网上说的更改运行时库还是不能编译通过,怎么办??

解决方案

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


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

using namespace std;

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

private:

};

A::A()
{
}

A::~A()
{
}

int main() 
{
    
    

    return 0;
}

这篇关于c++ - 老问题error LNK2005: &quot;public: void __thiscall的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆