我试图在SDL中做一个线程。我已经遵循了所有我能在网上找到的方向,但是我--我--不断地发现这个错误:
SDL\sample_profiler.cpp|72|error:从'int‘到'int ()(void)’-fpermissive|的无效转换
下面是我创建线程的代码:
void sample_profiler::run()
{
if (m_the_game_world->level_load())
{
SDL_Thread *l_thread;
l_thread = SDL_CreateThread(thread_run(m_the_game_world), "sample_thread",(void *)NULL);
}
}以下是我在头文件中的函数: int thread_run(void *p_the_game_world);
发布于 2014-05-10 12:32:08
问题是函数调用SDL_CreateThread()的第一个参数。SDL_CreateThread()需要一个函数指针。您要做的是调用函数并传递其结果,即int,作为第一个参数。
这将是一个正确的呼吁:
int Test( void* p )
{
return 0 ;
}
SDL_Thread* id = SDL_CreateThread( Test , "test" , ( void* )NULL );https://stackoverflow.com/questions/23580437
复制相似问题