<分区>
我创建了这个,但我收到链接错误,但我不知道为什么...
系统信息.h
#include <iostream>
class SysInfo
{
public:
SysInfo();
~SysInfo();
private:
};
系统信息.cpp
#include "SysInfo.h"
using namespace std;
SysInfo::SysInfo()
{
cout << "Object is being created" << endl;
}
SysInfo::~SysInfo()
{
cout << "Object is being deleted" << endl;
}
主要
#include <tchar.h>
#include "Sysinfo.h"
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
SysInfo inf;
getchar();
return 0;
}
留言
warning C4930: 'SysInfo inf(void)': prototyped function not called (was a variable definition intended?)
问题已解决。您看到的代码是更正后的代码。我改了#include <SysInfo.h>
至 #include "SysInfo.h"
并关闭 visual studio 2012 中的预编译设置。这也会导致错误。