title: Does gcc support multi-line raw string literals in macro definition?
body: <p>I want to put a constant json string in a <strong>header</strong> file, so that it can be used and also viewed by other sources. I want to use raw string literals in C++11, because it looks clear and pretty. However, i have tried gcc 4.8.5/gcc 4.9.2 to compile the following code using <code>gcc -std=c++11 test.cpp</code>:</p>
  
  <pre class="lang-cpp prettyprint-override"><code>#include &lt;cstdio&gt;
  
  /* works, but looks ugly */
  #define STR_a \
  "{ \n\
      \"AAA\": \"a\", \n\
      \"BBB\": \"b\" \n\
  }"
  
  /* works with VS2017, not works with gcc */
  #define STR_b \
  R"({
      "AAA": "a",
      "BBB": "b"
  })";
  
  /* works, but must use 'extern const'/'static' in header files */
  const char *STR_var = 1 + R"(
  {
      "AAA": "a",
      "BBB": "b"
  })";
  
  int main()
  {
      const char *s = STR_b;
      printf("%s\n", s);
      return 0;
  }
  </code></pre>
  
  <p>However, i get compile errors:</p>
  
  <pre>   
  
  test.cpp:16:1: error: unterminated raw string
   R"({ 
   ^
  test.cpp:19:3: warning: missing terminating " character
   })";
     ^
  test.cpp:19:1: error: missing terminating " character
   })";
   ^
  test.cpp:29:2: error: stray ‘R’ in program
  </pre>
  
  <p>If i add backslashs, gcc works:</p>
  
  <pre class="lang-cpp prettyprint-override"><code>#define STR_b \
  R"({ \
      "AAA": "a", \
      "BBB": "b" \
  })";
  </code></pre>
  
  <p>But it shows wrong string:</p>
  
  <pre>
  { \
      "AAA": "a", \
      "BBB": "b" \
  }
  </pre>
  
  <p>Is it an implementation-defined feature? Does higher versions of gcc support this feature?</p>
  
  <hr>
  
  <p>Edit:   </p>
  
  <p>I downloaded and compiled gcc 7.3.1 source, then tried again for my test code; however, gcc7.3.1 reports the same errors like gcc 4.X. I give up, and decide to continue to use <code>static const char *</code>. The answer of @lyang is also good, it opens my minds.</p>