error: expected unqualified-id before string constant
After some research, i still don't understand the problem.
Const.hpp :
#ifndef CONST_HPP
#define CONST_HPP
#include <QString>
const QString CONFFILENAME("dsibubble.ini"),
STRSEP(" | ");
const int MAXIMGWIDTH = 960;
#endif // CONST_HPP
TabDataBase.cpp :
#include "Const.hpp"
func() {
QString abc = STRSEP开发者_运维技巧;
}
The use of STRSEP
generate an expected unqualified-id before string constant
error.
Moreover i use CONFFILENAME
in an other class and i have no error.
QString path = QString("..//") + CONFFILENAME;
EDIT: Error's detail :
In file included ..\TabDataBase.cpp: #include "Const.hpp"
expected unqualified-id before string constant: Const.hpp : STRSEP(" | ");
I think you have defined STRSEP as a string literal somewhere like:
#define STRSEP "blahblah"
Because I compiled your snippet and it's fine, but adding a define like the previous one I get the same error.
Try defining the two constants using two separate statements. It's the only thing that I can think of that might have an effect.
精彩评论