I am sending this message again because I realized the proportional font in the error message made it hard to interpret. I am now using a fixed spacing font, but I don’t
know if the listserv will preserve this.
I have defined the following macro to print an error message:
#define ERR_ARGS(fmt,...) asynPrint(mSet->getUser(), ASYN_TRACE_ERROR, \
"Param[%s]::%s: "fmt"\n", mAsynName.c_str(), functionName, __VA_ARGS__);
I call it like this:
if(status) {
ERR_ARGS("[param=%s] failed to create param", mAsynName.c_str());
throw std::runtime_error(mAsynName);
}
So the fmt macro argument is a constant string, which is concatenated with the other constant strings in this _expression_: "Param[%s]::%s: "fmt"\n"
This compiles fine with gcc 4.8.5 and Visual Studio 2015.
However, on gcc 7.3.0 (Ubuntu 18) I get the following error:
../GenICamFeature.cpp: In constructor ‘GenICamFeature::GenICamFeature(GenICamFeatureSet*, const string&, asynParamType, int, const string&, GCFeatureType_t)’:
../GenICamFeature.cpp:15:25: error: unable to find string literal operator ‘operator""fmt’ with ‘const char [17]’, ‘long unsigned int’ arguments
"Param[%s]::%s: "fmt"\n", mAsynName.c_str(), functionName, __VA_ARGS__);
^
/corvette/home/epics/devel/asyn-4-35/include/asynDriver.h:272:66: note: in definition of macro ‘asynPrint’
? pasynTrace->printSource(pasynUser,reason,__FILE__,__LINE__,format) \
^~~~~~
../GenICamFeature.cpp:80:13: note: in expansion of macro ‘ERR_ARGS’
ERR_ARGS("[param=%s] failed to create param", mAsynName.c_str());
^~~~~~~~
Any ideas why I am getting the error and how to eliminate it?
Thanks,
Mark