我一直在跟踪示例,但不起作用,如何解决此问题?错误消息:
错误LNK2019:未解析的外部符号“ public:void __thiscall CWin :: show_member(void)”(?show_member @ CWin @@ QAEXXZ)在函数_wmain c:... \ TEST_DOMAIN_MODULE.obj中引用
错误LNK1120:1个未解决的外部设备c:... \ TEST_DOMAIN_MODULE.exe 1
// A_DOMAIN_MODULE.h
#pragma once
#include <iostream>
using namespace std;
class CWin
{
private:
char id;
int width, height;
public:
CWin(char i,int w,int h):id(i),width(w),height(h) {}
void show_member(void);
};
// A_DOMAIN_MODULE.cpp
#include "stdafx.h"
#include "A_DOMAIN_MODULE.h"
void CWin::show_member(void)
{
cout << "Window " << id << ": ";
cout << "width=" << width << ", height=" << height << endl;
}
// TEST_DOMAIN_MODULE.cpp
#include "stdafx.h"
#include "../A_DOMAIN_MODULE/A_DOMAIN_MODULE.h"
int main()
{
CWin win1('A',50,40);
win1.show_member();
system("pause");
return 0;
}