好吧,我是个菜鸟,但我认为我已经正确设置了所有这些,而且我被认为是:
[Admin@shadowrealm ircservices]$ g++ main.cpp -o services
In file included from main.cpp:1:0:
services.h:8:15: error: ISO C++ forbids declaration of âserivcesâ with no type [-fpermissive]
由编译器(使用 g++)
主.cpp:
#include "services.h"
#include <iostream>
using namespace std;
int main(int ac, char **av)
{
services myservices;
if(myservices.startup() == 1)
cout << "Cool this works!!" << endl;
return(0);
}
服务.h:
#ifndef SERVICES_H
#define SERVICES_H
class services
{
public:
serivces();
~services();
int startup();
};
#endif
服务.cpp:
#include "services.h"
services::services()
{
}
services::~services()
{
}
int services::startup()
{
return 1;
}
这让我感到困惑,但正如我所说,我不是这方面的专业人士,所以请注意它是一些明显的错误,比如“将 1 更改为 2”或其他什么......