fork download
  1. #include <cstdio>
  2.  
  3. #define MY_STRING "trololo\file\header.h"
  4.  
  5. #define IMPL_CONCAT(s1, s2, s3) s1 # s2 # s3
  6. #define CONCAT(s1, s2, s3) IMPL_CONCAT(s1, s2, s3)
  7.  
  8. #define RAW(s) CONCAT(R"(", s, ")")
  9.  
  10. int main() {
  11. std::puts(MY_STRING);
  12. std::puts(RAW(MY_STRING));
  13. }
Compilation error #stdin compilation error #stdout 0s 16064KB
stdin
Standard input is empty
compilation info
prog.cpp:12:25: error: macro "CONCAT" requires 3 arguments, but only 1 given
  std::puts(RAW(MY_STRING));
                         ^
prog.cpp: In function ‘int main()’:
prog.cpp:3:19: warning: unknown escape sequence: '\h'
 #define MY_STRING "trololo\file\header.h"
                   ^
prog.cpp:11:12: note: in expansion of macro ‘MY_STRING’
  std::puts(MY_STRING);
            ^~~~~~~~~
prog.cpp:8:16: error: ‘CONCAT’ was not declared in this scope
 #define RAW(s) CONCAT(R"(", s, ")")
                ^
prog.cpp:12:12: note: in expansion of macro ‘RAW’
  std::puts(RAW(MY_STRING));
            ^~~
stdout
Standard output is empty