| Eclipse marks macros from inttypes.h as syntax errors [message #1016685] |
Thu, 07 March 2013 05:56  |
Konstantin Miller Messages: 2 Registered: March 2013 |
Junior Member |
|
|
Hi!
When I am using macros from inttypes.h (that allow for portable usage of printf-like formatting string across architectures), e.g., like this:
printf("This is a 64-bit integer: %"PRId64".\n", (int64_t)23);
Eclipse marks the line as "Syntax error". This is very annoying in code that uses many printf-like functions (fprintf, sprintf, fscanf, sscanf, etc). I am compiling the code using a manually generated makefile and everything compiles and runs so that I assume that the problem is with Eclipse?
Best,
Konstantin
|
|
|
| Re: Eclipse marks macros from inttypes.h as syntax errors [message #1016917 is a reply to message #1016685] |
Fri, 08 March 2013 03:27   |
Axel Mueller Messages: 1823 Registered: July 2009 |
Senior Member |
|
|
Havae a look at the code from inttypes.h
/* The ISO C99 standard specifies that these macros must only be
defined if explicitly requested. */
#if !defined __cplusplus || defined __STDC_FORMAT_MACROS
=> you must define __STDC_FORMAT_MACROS to get it working.
I guess you are setting this define in your Makefile. You should add this define in Eclipse to Project Properties->C/C++ General->Paths and Symbols
Before you ask
- search this forum
- see the FAQ http://wiki.eclipse.org/CDT/User/FAQ
- google
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.02291 seconds