Question

I'm trying to create a linux man page for my program. I'm using getopt to parse several command line arguments and flags, one of which may be 'h', which should print the man page then exit.

I'm programming in VS 2013, and this nagging little error won't go away. According to intellisense, a semicolon is expected on the line that says "-c, --container\n". From my understanding of multi-line string literals, you only place a semicolon after the body of text you want to put inside a std::string, which is why this is particularly frustrating.

Below is my code:

case 'h':{
        string out;
        out = "NAME\n"
            "\tblah.\n"
            "SYNOPSIS\n"
            "\tmore text\n"
            "\tprogram (­-h | ­­--help)"
            "DESCRIPTION\n"
            "\ttext text text\n"
            "\tAI. mpre text\n"
            "\ttext\n"
            "\ttext.\n"
            "OPTIONS\n"
            "-h, --­­help\n"
            "\tPrint this help screen and exit.\n"
            ­"-c, --­­container\n"
            "\ttext\n"
            "\ttext\n"
            ­"text\n"
            "\ttext.\n"
            ­"-v, --­­verbose N\n"
            "\tdescriptions\n"
            "\tstatistics.\n"
            ­"-d, --­­debug\n"
            "\ttext\n";
        ss << out;
        cout << ss.str();
        cout.flush();
        exit(0);
        break;
    }

How can I fix this particularly annoying error? Thanks in advance.

Was it helpful?

Solution

When I copy-and-paste your source code, I get some odd non-printable characters, including some on the "-c, --­­container\n" line. They appear to be UTF-8 encoded SOFT HYPHEN characters (the UTF-8 encoding may be an artifact of how you copy-and-pasted the code into your web browser). Filter those out and you should be ok.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top