I am compiling my code with gcc 4.7.0. My code compiles fine with 4.6.1. However with 4.7.0, it shows:
unable to find string literal operator ?operator"" PRIxPTR?
I have included proper inttypes.h file. If I try to redefine this, it complains that it is already defined.
Here is the erring code:
printf("%016"PRIxPTR" ", addr);
Can you tell the solution/workaround? Thanks.
Add a space before the PRIxPTR:
The reason is that since gcc 4.7, user-defined literals are supported in C++11 mode. One consequence is that
"%016"PRIxPTRis no longer two separate tokens, and one may define (although GCC disallows that) a user-defined literal to do something strange e.g.(If you are not using C++11 mode but encounter this error, please post a bug to GCC.)