- 论坛徽章:
- 0
|
本帖最后由 ytu_cyc 于 2011-07-06 20:20 编辑
- #include <pthread.h>
- class Test
- {
- public:
- Test();
- private:
- pthread_t ptid;
- void * do_thread(void *);
- };
- Test::Test()
- {
- int ret = pthread_create(&ptid, NULL, do_thread, NULL);
- //check return value.
- }
- void * Test::do_thread(void *args)
- {
- return NULL;
- }
- int main(void)
- {
- return 0;
- }
复制代码 g++ Test.cpp -lpthread -Wall
Error Msg:- Test.cpp: In constructor ‘Test::Test()’:
- Test.cpp:15:55: error: argument of type ‘void* (Test::)(void*)’ does not match ‘void* (*)(void*)’
复制代码 为什么not match呀?
怎么解决?
多谢。 |
|