c++11 error:unable to find string literal operator ' operator '
A simple macro C + + #define Log_information (x, ...) Log_me ("%s:%d," x, __function__,__line__, # #__VA_ARGS__)
1 |
#define LOG_INFORMATION (x, ...) Log_me ("%s:%d," x, __function__,__line__, # #__VA_ARGS__) |
Can compile normally, but when C++11 is enabled, the report compiles error C + + complier the error Shell error:unable to find string literal operator ' operator ' "X '
1 |
Error:unable to find string literal operator ' operator ' "X ' |
Online search, said is c++11 requirements, when the string and variable connection, you must add a space to do. So simply modify it as follows. C + + #if __cplusplus < 201103L #define Log_information (x, ...) Log_me ("%s:%d," x, __function__,__line__, # #__VA_ARGS__) #else #define Log_information (x, ...) Log_me ("%s:%d," x, __function__,__line__, # #__VA_ARGS__) #endif
1 2 3 4 5 |
#if __cplusplus < 201103L #define Log_information (x, ...) Log_me ("%s:%d," x, __function__,__line__, # #__VA_ARGS__) #else #define Log_information (x, ...) Log_me ("%s:%d," x, __function__,__line__, # #__VA_ARGS__) #endif |
Note: The version of GCC used in "android-ndk-r10e", GCC-4.9 prior to the release of the "__cplusplus" Macro definition error problem, you need to refer to "NDK under GCC definition __ Cplusplus incorrect problem ", upgrade GCC to 4.9