error: ‘pthread’ does not name a type
error: ‘pthread’ does not name a type
我正在尝试编译我的项目,但看到以下错误。
代码:RESTServer.h
#ifndef __RESTSERVER__
#define __RESTSERVER__
#include <string>
#include <pthread.h>
using namespace std;
class RESTServer{
private:
RESTServer();
~RESTServer();
public:
static pthread *thread;
static void init_rest_server();
};
#endif
错误:
RESTServer.h:14:10: error: ‘pthread’ does not name a type
static pthread *thread;
我正在尝试将指向 pthread 的指针声明为 C++ 的成员 class。谁能帮我一下。
阅读pthread_create(3);线程句柄的不透明类型是 pthread_t
(不是 pthread*
)。
顺便说一句,希望您使用一些好的 C++11 - 或 C++14- 实现(例如 GCC 5 or GCC 6 on Linux) you should consider using C++11 threads library, i.e. std::thread.
我正在尝试编译我的项目,但看到以下错误。
代码:RESTServer.h
#ifndef __RESTSERVER__
#define __RESTSERVER__
#include <string>
#include <pthread.h>
using namespace std;
class RESTServer{
private:
RESTServer();
~RESTServer();
public:
static pthread *thread;
static void init_rest_server();
};
#endif
错误:
RESTServer.h:14:10: error: ‘pthread’ does not name a type
static pthread *thread;
我正在尝试将指向 pthread 的指针声明为 C++ 的成员 class。谁能帮我一下。
阅读pthread_create(3);线程句柄的不透明类型是 pthread_t
(不是 pthread*
)。
顺便说一句,希望您使用一些好的 C++11 - 或 C++14- 实现(例如 GCC 5 or GCC 6 on Linux) you should consider using C++11 threads library, i.e. std::thread.