c++错误:??不命名类型
c++ error: ??? does not name a type
运行g++ main.cpp -o services
如果我在一个类中做所有这些,让我们说。cpp它工作得很好,但是每当我把它分成另一个类时,我一直得到错误,我真的不明白为什么,我所做的就是把代码移动到另一个文件,并包括它。
我被扔了:
[Admin@shadowrealm ircservices]$ g++ main.cpp -o services
In file included from services.cpp:1:0,
from main.cpp:4:
services.h:23:2: error: âSOCKETâ does not name a type
services.h:24:2: error: âHOSTENTâ does not name a type
services.h:25:2: error: âSOCKADDR_INâ does not name a type
services.h:
#ifndef SERVICES_H
#define SERVICES_H
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <malloc.h>
#include <stdarg.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h>
class services {
public:
services(); //perhaps init something important here, dunno
~services();
int connect();
private:
SOCKET sock;
HOSTENT* host;
SOCKADDR_IN address;
};
#endif /* SERVICES_H */
services.cpp:
#include "services.h"
services::services()
{
//do nothing
}
services::~services()
{
//TODO: incase crash, log why.
}
int services::connect()
{
return 0;
}
c++区分大小写。右边是
sockaddr_in
hostent
如果我没记错的话,SOCKET或SOCKET根本没有命名类型
相关文章:
- ArduinoJson 6.15.2:JsonObject没有命名类型
- 防止主数据类型C++的隐式转换
- 大量序列中核苷酸类型的快速计数
- 如何从C++中的依赖类型中获得它所依赖的类型
- 有关插入适配器的错误。[错误]请求从 'back_insert_iterator<vector<>>' 类型转换为非标量类型
- 是否可以初始化不可复制类型的成员变量(或基类)
- 如何获取std::result_of函数的返回类型
- 从父命名空间重载类型
- 如果C++类在类方法中具有动态分配,但没有构造函数/析构函数或任何非静态成员,那么它仍然是POD类型吗
- 我想将一个对T类型的非常量左值引用绑定到一个T类型的临时值
- Openssl 1.1.1d无效使用不完整的类型"struct dsa_st"
- 访问者访问变体并返回不同类型时出错
- 在VS2010-VS2015下编译时,如何使用decltype作为较大类型表达式的LHS
- 处理小于cpu数据总线的数据类型.(c++转换为机器代码)
- C++ 雷神库 - 使用资源加载器类时出现问题(不命名类型)
- 模板元程序查找相似的连续类型名称
- 是否可以从int转换为enum类类型
- 构造函数正在调用一个使用当前类类型的函数
- 我应该使用什么来代替void作为变体中的替代类型之一
- 类中的字符串不命名类型