0
我有一个Foo类,它有一个主函数和执行函数。我想用execute函数启动未知数量的线程,但是当我尝试编译代码时,我总是得到error C2064: term does not evaluate to a function taking 1 arguments
。多线程 - 类中的异步线程
foo.h中
#ifndef BOT_H
#define BOT_H
#pragma once
#include <WinSock2.h>
#include <WS2tcpip.h>
#include <string>
class foo
{
public:
foo(char *_server, char *_port);
~foo(void);
private:
char *server;
char *port;
void execute(char *cmd);
void main();
};
#endif
foo.c的
#include <thread>
#include "bot.h"
#include "definitions.h"
using namespace std;
foo::foo(char *_server, char *_port){
...
}
bot::~bot(void) {
...
}
void bot::execute(char *command){
...
}
void bot::main(){
thread(&bot::execute, (char*)commanda.c_str()).detach();
}
我应该如何创建类的成员函数的线程?
感谢您的任何答案