I have a class named Thread in which I have this functions:
1 2 3 4 5 6 7 8 9 10 11
void Start( void(*workerFunction)() )
{
struct Info
{
void(*workerFunction)();
};
Info* info = new Info;
info->workerFunction = workerFunction;
startThread( workerFunction0<Info>, (void*)info ); //This is line 57
}
1 2 3 4 5 6
void startThread( void*(*workerFunction)(void*), void* info ) //This is line 135
{
if ( pthread_create( &thread, 0, workerFunction, info ) != 0 )
throw OutOfOtherResourcesError();
}
../../src/threading/thread.h:57: error: no matching function for call to ‘mpi::Thread::startThread(<unresolved overloaded function type>, void*)’
../../src/threading/thread.h:135: note: candidates are: void mpi::Thread::startThread(void* (*)(void*), void*)
I posted the error I got from g++, basicly what I noticed is that when I fill in the template argument like this: functionPointerType = function<templateType>;
it can't resolve the function with template argument to the resulting pointer type.
Doesn't really change anything here. I found the problem though.
For some reason I can't use a class/struct that was defined within the function itself. I moved the Info class out of the function in to the class and now it works.