How to Solve QT uses MSVC compiler to code error

QT uses MSVC compiler, and the code reports an error

1. Premise

After inspection, it is confirmed that your code is correct, and the error reported by QT creator is a pure false alarm.

2. Error examples

[error] Constants with newlines
[error] xxx is not a member of xxx
[error] Syntax error, missing ;
...

3. Solutions

Add the following configuration in *.Pro file.

win32-msvc*: {
    QMAKE_CFLAGS *= /utf-8
    QMAKE_CXXFLAGS *= /utf-8
}

Read More: