I'm trying to make a class that can hold and later call functions. It stores the functions in a map along with a string that holds the name of the function.
I tried doing this on Linux with GCC and got the following error: "invalid conversion from void(*)() to void *" on the line functionsMap[nameOfFunction] = func; 
Here's the entire program I have so far. It's not done yet, but I'm really curious as to why this would compile under Visual C++ and not GCC. If I'm doing something wrong or could be doing something better, please let me know. Thanks!
#include <iostream>
#include <map>
#include <string>
using namespace std; 
class Dyn_Class{
private: 
    map<string, void *> functionsMap; 
public: 
    Dyn_Class(){} 
    template<typename ReturnValue>
    void add_func( string nameOfFunction, ReturnValue(*func)() ){
        functionsMap[nameOfFunction] = func; 
    }
    void remove_func( string nameOfFunction ){
    }
    Dyn_Class operator()(string nameOfFunction){
    }
}; 
void print(void){
    for(int index = 0; index < 9; index++){
        cout << index << "   "; 
    }
    cout << endl; 
}
int main(){
    Dyn_Class functionsList; 
    functionsList.add_func("print", print); 
    return 0; 
}
 
     
     
     
    