使用GCC 4.8构建错误:用作初始化程序的数组

时间:2018-04-25 14:56:55

标签: c++ gcc compiler-errors

在SUSE上使用gcc 4.8我收到以下错误:

有谁知道这个错误的来源是什么,以及如何解决它?

我回来了解更多细节:

拥有以下课程

smoquery.h 

    class SmoQuery
    {
        public:
            SmoQuery(SqlLogonElem *        const   & eLogon,
                     optionsInfo_t *       const   & optionsInfoP,
                     logicalNameList_t *   const   & pRequestedDbList,
                     logicalNameList_t *   const   & pExcludeDbList,
                     SqlDatabaseElem *     const   & peDatabase,
                     dsBool_t              const     bIncludeFrontEndCapacity, 
                     dsBool_t              const     bReplacementChars);

            ~SmoQuery();

        private:
            Options mOptions;

            char optionsFilePath[PATH_MAX+1] = "";
    };


smoquery.cpp

SmoQuery::SmoQuery(SqlLogonElem *         const   & eLogon,
                   optionsInfo_t *       const   & optionsInfoP,
                   logicalNameList_t *   const   & pRequestedDbList,
                   logicalNameList_t *   const   & pExcludeDbList,
                   SqlDatabaseElem *     const   & peDatabase,
                   dsBool_t               const       bIncludeFrontEndCapacity, 
/*line 80 --->*/                   dsBool_t              const        bReplacementChars)
{
/* all code was commented */
}

构建日志说:

Gmake build ...(此评论中删除了包含内容)

g++ -D_LINUX -D_LINUX64 -DLINUX64 -D_LINUXAMD64 -DMBCS_AIX -D_THREADS -D_CPP_ALL -DNO_CDE -D_LONG_LONG -D_LARGEFILE64_SOURCE -DWIDE_CHAR_FIX -DDSMAPILIB -DDSM_STANDALONE_PROGRAM -DUNIX -D_FILE_OFFSET_BITS=64 -D_NEED_USING_NAMESPACE -D_GNU_SOURCE -DSQL -O -I. -I.. .... -fpermissive -fpic -fstack-protector -Wall -Wno-write-strings -Wno-missing-braces -DBUILD_TSM_V816 -std=c++11 -c smoquery.cpp -o ../../sqlonlinux/optimized/obj816/linuxAMD64/smoquery.o

...

smoquery.cpp: In constructor ‘SmoQuery::SmoQuery(SqlLogonElem* const&, optionsInfo_t* const&, logicalNameList_t* const&, logicalNameList_t* const&, SqlDatabaseElem* const&, dsBool_t, dsBool_t)’:
smoquery.cpp:132:72: error: array used as initializer
                    dsBool_t              const        bReplacementChars)
                                                                        ^
In file included from smoquery.cpp:80:0:

1 个答案:

答案 0 :(得分:0)

麻烦的是这个成员的初始化

char optionsFilePath [PATH_MAX + 1] ="";

gcc 4.8(我使用的)误导了一线麻烦(那个符号^符号)。

任何人都可以提交错误吗?