LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

error: expected expression

Solved!
Go to solution

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).

0 Kudos
Message 1 of 4
(4,650 Views)

Have you noticed if this error is reproducible with any other code using this function, or if the same error happens with other code?

0 Kudos
Message 2 of 4
(4,624 Views)
Solution
Accepted by topic author gdargaud

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 !

0 Kudos
Message 3 of 4
(4,589 Views)

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.

0 Kudos
Message 4 of 4
(4,577 Views)