2012-07-29 2 views
1

내가 우분투와 g ++ 에서 잘 작동하지만 FreeBSD를 컴파일하는 데 실패 코드를 가지고, 난 아무 생각이 왜그램 ++ (FreeBSD의) 오류 : 이전에 예상되는 주요 표현 '{'토큰

//in the source body MyClass.cpp 
     void MyClass::app_init() 
     { 

      funcs[0] = { &MyClass::app_map, 4 }; 
      funcs[1] = { &MyClass::app_pro, 10 }; 


     } 


     //in the header MyClass.h 
     public: 

     struct foo 
     { 
      int fd; 
      time_t ts; 
     }; 

     struct func 
     { 
      void (MyClass::*f) (foo *); 
      int arg_length; 
     }; 



     void app_init(); 
     void app_map(foo *a); 
     void app_pro(foo *a); 

     private: 
     func funcs[FUNCS_ARRAY]; //2 
+0

그리고 어떤 문자열이 오류를 발생 시키나요? – ForEveR

답변

3
funcs[0] = (func){ &MyClass::app_map, 4 }; 
... 

또는 함께 컴파일 g++ --std=c++11 ...

관련 문제