mercredi 19 octobre 2022

Raw string literals won't compile on macOS? [duplicate]

For some reason, the code compiles on Windows but not on macOS. The issue appears to be a raw string literal that I was using so that I could write a multi-line string.

#include <iostream>
#include <string>

using namespace std;

int main()
{
    string test = R"(
        This is a 
        test string.
    )";
    cout << test << endl;
}

I get the following error after attempting to run this file:

error: use of undeclared identifier 'R'
    string test = R"(

Aucun commentaire:

Enregistrer un commentaire