No matching function call to 'pthread_create'

来源:互联网 发布:智能锁屏软件 编辑:程序博客网 时间:2024/06/10 17:19


以下代码报错:No matching function call to 'pthread_create'

#include <pthread.h>void *draw(void *pt) {    // ...}void *input(void *pt) {    // ....}void Game::create_threads(void) {    pthread_t draw_t, input_t;    pthread_create(&draw_t, NULL, &Game::draw, NULL);   // Error    pthread_create(&input_t, NULL, &Game::draw, NULL);  // Error    // ...}

原因:

pthread_create的函数必须为  (void*)(*)(void*) 的格式

ref:http://stackoverflow.com/questions/10389384/no-matching-function-call-to-pthread-create

原创粉丝点击