相关疑难解决方法(0)

错误:字符串常量之前的预期unqualified-id

经过一番研究,我仍然不明白这个问题.

Const.hpp:

#ifndef CONST_HPP
#define CONST_HPP

#include <QString>

    const QString   CONFFILENAME("dsibubble.ini"),
                    STRSEP(" | ");

    const int       MAXIMGWIDTH = 960;

#endif // CONST_HPP  
Run Code Online (Sandbox Code Playgroud)

TabDataBase.cpp:

#include "Const.hpp"
func() {

    QString abc = STRSEP;

}
Run Code Online (Sandbox Code Playgroud)

使用STRSEP生成expected unqualified-id before string constant错误.此外,我CONFFILENAME在其他类使用,我没有错误.

QString path = QString("..//") + CONFFILENAME;
Run Code Online (Sandbox Code Playgroud)

编辑:错误的细节:

In file included ..\TabDataBase.cpp: #include "Const.hpp"  
expected unqualified-id before string constant: Const.hpp : STRSEP(" | ");
Run Code Online (Sandbox Code Playgroud)

c++

2
推荐指数
1
解决办法
1万
查看次数

标签 统计

c++ ×1