title: Error: invalid operands of types ‘const char [35]’ and ‘const char [2]’ to binary ‘operator+’
body: <p>At the top of my file I have</p>
  <pre><code>#define AGE &quot;42&quot;
  </code></pre>
  <p>Later in the file I use ID multiple times including some lines that look like</p>
  <pre><code>std::string name = &quot;Obama&quot;;
  std::string str = &quot;Hello &quot; + name + &quot; you are &quot; + AGE + &quot; years old!&quot;;
  str += &quot;Do you feel &quot; + AGE + &quot; years old?&quot;;
  </code></pre>
  <p>I get the error:</p>
  <blockquote>
  <p>&quot;error: invalid operands of types ‘const char [35]’ and ‘const char [2]’ to binary ‘operator+’&quot;</p>
  </blockquote>
  <p>on line 3. I did some research and found it was because of how C++ was treating the different strings and was able to fix it by changing &quot;AGE&quot; to &quot;string(AGE).&quot; However, I accidentally missed one of the instances until today and was wondering why the compiler wasn't complaining even though I still had an instance where it was just &quot;AGE&quot;.</p>
  <p>Through some trial and error I found that I only need <code>string(AGE)</code> on lines where I don't concatenate another string that was created in the function body.</p>
  <p>My questions is &quot;what is going on in the background that C++ doesn't like concatenating a string with a string put there by the preprocessor unless you are also concatenating string that you defined in the function.&quot;</p>