经过一番研究,我仍然不明白这个问题.
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++ ×1