-
Notifications
You must be signed in to change notification settings - Fork 174
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
new c++11 string literal breaks macrodefenitions in stage.hh #64
Comments
added the diff file, sorry in the comment it looks realy ugly |
See #62 |
which directory should I put the stage.hh.diff file to? |
you have to apply the patch with the terminal command "patch"! here is a tutorial: |
applied PR for #62 to fix. Thanks. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
get error when compiling:
In file included from src/stageros.cpp:38:0:
/opt/ros/indigo/lib/cmake/Stage/../../../include/Stage-4.1/stage.hh: In member function ‘virtual void Stg::Ancestor::SetToken(const string&)’:
/opt/ros/indigo/lib/cmake/Stage/../../../include/Stage-4.1/stage.hh:625:62: error: unable to find string literal operator ‘operator""m’ with ‘const char [24]’, ‘long unsigned int’ arguments
#define PRINT_ERR(m) fprintf( stderr, "\033[41merr\033[0m: "m" (%s %s)\n", FILE, FUNCTION)
^
/opt/ros/indigo/lib/cmake/Stage/../../../include/Stage-4.1/stage.hh:725:2: note: in expansion of macro ‘PRINT_ERR’
PRINT_ERR( "Ancestor::SetToken() called with zero length string. Ignored." );
^~~~~~~~~
/opt/ros/indigo/lib/cmake/Stage/../../../include/Stage-4.1/stage.hh: In member function ‘virtual void Stg::Model::SetToken(const string&)’:
/opt/ros/indigo/lib/cmake/Stage/../../../include/Stage-4.1/stage.hh:625:62: error: unable to find string literal operator ‘operator""m’ with ‘const char [24]’, ‘long unsigned int’ arguments
#define PRINT_ERR(m) fprintf( stderr, "\033[41merr\033[0m: "m" (%s %s)\n", FILE, FUNCTION)
^
/opt/ros/indigo/lib/cmake/Stage/../../../include/Stage-4.1/stage.hh:2032:2: note: in expansion of macro ‘PRINT_ERR’
PRINT_ERR( "Model::SetToken() called with zero length string. Ignored." );
^~~~~~~~~
make[2]: *** [CMakeFiles/stageros.dir/build.make:63: CMakeFiles/stageros.dir/src/stageros.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:805: CMakeFiles/stageros.dir/all] Error 2
make: *** [Makefile:128: all] Error 2
the problem is that in c++11 new string literals could be defined (e.g. operator ""m) thus the macrodefinitions won't work anymore
solved it with a patch of libstage/stage.hh:
@@ -647,46 +647,46 @@
{ cont.erase( std::remove( cont.begin(), cont.end(), thing ), cont.end() ); }
// Error macros - output goes to stderr
-#define PRINT_ERR(m) fprintf( stderr, "\033[41merr\033[0m: "m" (%s %s)\n", FILE, FUNCTION)
-#define PRINT_ERR1(m,a) fprintf( stderr, "\033[41merr\033[0m: "m" (%s %s)\n", a, FILE, FUNCTION)
-#define PRINT_ERR2(m,a,b) fprintf( stderr, "\033[41merr\033[0m: "m" (%s %s)\n", a, b, FILE, FUNCTION)
-#define PRINT_ERR3(m,a,b,c) fprintf( stderr, "\033[41merr\033[0m: "m" (%s %s)\n", a, b, c, FILE, FUNCTION)
-#define PRINT_ERR4(m,a,b,c,d) fprintf( stderr, "\033[41merr\033[0m: "m" (%s %s)\n", a, b, c, d, FILE, FUNCTION)
-#define PRINT_ERR5(m,a,b,c,d,e) fprintf( stderr, "\033[41merr\033[0m: "m" (%s %s)\n", a, b, c, d, e, FILE, FUNCTION)
+#define PRINT_ERR(m) fprintf( stderr, "\033[41merr\033[0m: "#m" (%s %s)\n", FILE, FUNCTION)
+#define PRINT_ERR1(m,a) fprintf( stderr, "\033[41merr\033[0m: "#m" (%s %s)\n", a, FILE, FUNCTION)
+#define PRINT_ERR2(m,a,b) fprintf( stderr, "\033[41merr\033[0m: "#m" (%s %s)\n", a, b, FILE, FUNCTION)
+#define PRINT_ERR3(m,a,b,c) fprintf( stderr, "\033[41merr\033[0m: "#m" (%s %s)\n", a, b, c, FILE, FUNCTION)
+#define PRINT_ERR4(m,a,b,c,d) fprintf( stderr, "\033[41merr\033[0m: "#m" (%s %s)\n", a, b, c, d, FILE, FUNCTION)
+#define PRINT_ERR5(m,a,b,c,d,e) fprintf( stderr, "\033[41merr\033[0m: "#m" (%s %s)\n", a, b, c, d, e, FILE, FUNCTION)
// Warning macros
-#define PRINT_WARN(m) printf( "\033[44mwarn\033[0m: "m" (%s %s)\n", FILE, FUNCTION)
-#define PRINT_WARN1(m,a) printf( "\033[44mwarn\033[0m: "m" (%s %s)\n", a, FILE, FUNCTION)
-#define PRINT_WARN2(m,a,b) printf( "\033[44mwarn\033[0m: "m" (%s %s)\n", a, b, FILE, FUNCTION)
-#define PRINT_WARN3(m,a,b,c) printf( "\033[44mwarn\033[0m: "m" (%s %s)\n", a, b, c, FILE, FUNCTION)
-#define PRINT_WARN4(m,a,b,c,d) printf( "\033[44mwarn\033[0m: "m" (%s %s)\n", a, b, c, d, FILE, FUNCTION)
-#define PRINT_WARN5(m,a,b,c,d,e) printf( "\033[44mwarn\033[0m: "m" (%s %s)\n", a, b, c, d, e, FILE, FUNCTION)
+#define PRINT_WARN(m) printf( "\033[44mwarn\033[0m: "#m" (%s %s)\n", FILE, FUNCTION)
+#define PRINT_WARN1(m,a) printf( "\033[44mwarn\033[0m: "#m" (%s %s)\n", a, FILE, FUNCTION)
+#define PRINT_WARN2(m,a,b) printf( "\033[44mwarn\033[0m: "#m" (%s %s)\n", a, b, FILE, FUNCTION)
+#define PRINT_WARN3(m,a,b,c) printf( "\033[44mwarn\033[0m: "#m" (%s %s)\n", a, b, c, FILE, FUNCTION)
+#define PRINT_WARN4(m,a,b,c,d) printf( "\033[44mwarn\033[0m: "#m" (%s %s)\n", a, b, c, d, FILE, FUNCTION)
+#define PRINT_WARN5(m,a,b,c,d,e) printf( "\033[44mwarn\033[0m: "#m" (%s %s)\n", a, b, c, d, e, FILE, FUNCTION)
// Message macros
#ifdef DEBUG
-#define PRINT_MSG(m) printf( "Stage: "m" (%s %s)\n", FILE, FUNCTION)
-#define PRINT_MSG1(m,a) printf( "Stage: "m" (%s %s)\n", a, FILE, FUNCTION)
-#define PRINT_MSG2(m,a,b) printf( "Stage: "m" (%s %s)\n", a, b, FILE, FUNCTION)
-#define PRINT_MSG3(m,a,b,c) printf( "Stage: "m" (%s %s)\n", a, b, c, FILE, FUNCTION)
-#define PRINT_MSG4(m,a,b,c,d) printf( "Stage: "m" (%s %s)\n", a, b, c, d, FILE, FUNCTION)
-#define PRINT_MSG5(m,a,b,c,d,e) printf( "Stage: "m" (%s %s)\n", a, b, c, d, e,FILE, FUNCTION)
+#define PRINT_MSG(m) printf( "Stage: "#m" (%s %s)\n", FILE, FUNCTION)
+#define PRINT_MSG1(m,a) printf( "Stage: "#m" (%s %s)\n", a, FILE, FUNCTION)
+#define PRINT_MSG2(m,a,b) printf( "Stage: "#m" (%s %s)\n", a, b, FILE, FUNCTION)
+#define PRINT_MSG3(m,a,b,c) printf( "Stage: "#m" (%s %s)\n", a, b, c, FILE, FUNCTION)
+#define PRINT_MSG4(m,a,b,c,d) printf( "Stage: "#m" (%s %s)\n", a, b, c, d, FILE, FUNCTION)
+#define PRINT_MSG5(m,a,b,c,d,e) printf( "Stage: "#m" (%s %s)\n", a, b, c, d, e,FILE, FUNCTION)
#else
-#define PRINT_MSG(m) printf( "Stage: "m"\n" )
-#define PRINT_MSG1(m,a) printf( "Stage: "m"\n", a)
-#define PRINT_MSG2(m,a,b) printf( "Stage: "m"\n,", a, b )
-#define PRINT_MSG3(m,a,b,c) printf( "Stage: "m"\n", a, b, c )
-#define PRINT_MSG4(m,a,b,c,d) printf( "Stage: "m"\n", a, b, c, d )
-#define PRINT_MSG5(m,a,b,c,d,e) printf( "Stage: "m"\n", a, b, c, d, e )
+#define PRINT_MSG(m) printf( "Stage: "#m"\n" )
+#define PRINT_MSG1(m,a) printf( "Stage: "#m"\n", a)
+#define PRINT_MSG2(m,a,b) printf( "Stage: "#m"\n,", a, b )
+#define PRINT_MSG3(m,a,b,c) printf( "Stage: "#m"\n", a, b, c )
+#define PRINT_MSG4(m,a,b,c,d) printf( "Stage: "#m"\n", a, b, c, d )
+#define PRINT_MSG5(m,a,b,c,d,e) printf( "Stage: "#m"\n", a, b, c, d, e )
#endif
// DEBUG macros
#ifdef DEBUG
-#define PRINT_DEBUG(m) printf( "debug: "m" (%s %s)\n", FILE, FUNCTION)
-#define PRINT_DEBUG1(m,a) printf( "debug: "m" (%s %s)\n", a, FILE, FUNCTION)
-#define PRINT_DEBUG2(m,a,b) printf( "debug: "m" (%s %s)\n", a, b, FILE, FUNCTION)
-#define PRINT_DEBUG3(m,a,b,c) printf( "debug: "m" (%s %s)\n", a, b, c, FILE, FUNCTION)
-#define PRINT_DEBUG4(m,a,b,c,d) printf( "debug: "m" (%s %s)\n", a, b, c ,d, FILE, FUNCTION)
-#define PRINT_DEBUG5(m,a,b,c,d,e) printf( "debug: "m" (%s %s)\n", a, b, c ,d, e, FILE, FUNCTION)
+#define PRINT_DEBUG(m) printf( "debug: "#m" (%s %s)\n", FILE, FUNCTION)
+#define PRINT_DEBUG1(m,a) printf( "debug: "#m" (%s %s)\n", a, FILE, FUNCTION)
+#define PRINT_DEBUG2(m,a,b) printf( "debug: "#m" (%s %s)\n", a, b, FILE, FUNCTION)
+#define PRINT_DEBUG3(m,a,b,c) printf( "debug: "#m" (%s %s)\n", a, b, c, FILE, FUNCTION)
+#define PRINT_DEBUG4(m,a,b,c,d) printf( "debug: "#m" (%s %s)\n", a, b, c ,d, FILE, FUNCTION)
+#define PRINT_DEBUG5(m,a,b,c,d,e) printf( "debug: "#m" (%s %s)\n", a, b, c ,d, e, FILE, FUNCTION)
#else
#define PRINT_DEBUG(m)
#define PRINT_DEBUG1(m,a)
The text was updated successfully, but these errors were encountered: