1.
.h文件中,类函数只有申明,没有定义
用vs2010写一个简单的类出现如题所示错误
创建C++控制台程序 空项目
头文件中添加demo.h文件
#ifndef _demo_h
#define _demo_h
class demo
{
private:
int a;
public:
void show();
demo();
~demo();
};
#endif
源文件中添加demo.cpp文件
#include"demo.h"
#include<iostream>
using namespace std;
void demo::show ()
{
cout<<a;
}
资源文件中添加test.cpp文件
#include"demo.h"
int main()
{
demo a;
a.show();
}