09-22-2016 04:56 PM
Hello, hello,
I ave a project which compiles fine on a 1st sytem, but when compiled on a second one, I get the following errors:
AutoRestart.c - 4 errors
54, 9 error: expected expression
Both use CVI 2015 and the .prj and the .cws are under subversion as well as the code, so everything should be the same.
The line which causes the error is:
OutputLogMsg("Some dumb text.");
Which has the following definition:
#define OutputLogMsg(fmt, ...) _OutputLogMsg(__func__, __LINE__, fmt, __VA_ARGS__) extern void _OutputLogMsg(const char* Function, const int Line, const char *fmt, ... ) __attribute__((__format__ (__printf__, 3, 0)));
Now, I repeat that this compiles fine on my system, but not on my colleague's (I don't have access to his system).
Solved! Go to Solution.
09-23-2016 08:47 AM
Have you noticed if this error is reproducible with any other code using this function, or if the same error happens with other code?
09-25-2016 03:26 PM
Ha, apparently they were using CVI2013 instead of 2015, and it didn't like the variadic macro, so I added a ## and it compiles on both now. Ship it !
09-26-2016 02:41 AM
It's not possible to edit messages anymore ? Anyway, for those interested, I rewrote the macro thusly:
#if _CVI_ < 1500 // warning: Use of comma pasting extension is non-portable #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wunexpected-token" #define OutputLogMsg(fmt, ...) _OutputLogMsg(__func__, __LINE__, fmt, ##__VA_ARGS__) #pragma clang diagnostic pop #else #define OutputLogMsg(fmt, ...) _OutputLogMsg(__func__, __LINE__, fmt, __VA_ARGS__) #endif
I have no idea if it works with CVI10 or previous, though.