gpt4 book ai didi

c++ - 为什么我会收到创建基础类(class)的警告?

转载 作者:行者123 更新时间:2023-11-27 23:54:29 26 4
gpt4 key购买 nike

<分区>

我创建了这个,但我收到链接错误,但我不知道为什么...

系统信息.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 中的预编译设置。这也会导致错误。

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com