expected unqualified-id before string constant

后端 未结 3 1100
傲寒
傲寒 2021-02-05 03:20

I\'m currently writing a C++ application which implements an Oscillator in conjuction with math.h. The code I have should work fine for the application (trying to compile an obj

3条回答
  •  佛祖请我去吃肉
    2021-02-05 03:36

    Another way to produce this error: define a macro to a string constant, and later, use the macro name as the name of a string constant. Example

    #define FOO "bar"
    static const char FOO[] = "bar"; // <-- Error "expected unqualified-id before string constant".
    

    The obvious answer is to remove one of the definitions, or change the name of one.

提交回复
热议问题