繁体   English   中英

g ++(freebsd)错误:在'{'标记之前预期的primary-expression

[英]g++ (freebsd) error: expected primary-expression before '{' token

我的代码在ubuntu中使用g ++工作正常,但无法在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
funcs[0] = (func){ &MyClass::app_map, 4 };
...

或用g++ --std=c++11 ...编译g++ --std=c++11 ...

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM