unrecognized command line option '-Zc:__cplusplus' and unrecognized command line option '-permissive-'

Viewed 838

I am trying to run and debug Qt6 widget application in clion. I tried the things that u would get when do a simple search but no success. Recently my friend told my to do this : Add "C:\Qt\Tools\mingw810_64" to toolchain environment like this : enter image description here

now when I create a Qt widget project like this :

enter image description here

I get these error :

Problems were encountered while collecting compiler information:
  g++.exe: error: unrecognized command line option '-Zc:__cplusplus'
  g++.exe: error: unrecognized command line option '-permissive-'; did you mean '-fpermissive'?

What should I do now ? Why doesn't it recognize these options ? I cannot change g++.exe file (or can I?) What can do about it?

I have been struggling to manage to run and debugg Qt6 project on clion the past few weeks.

God bless anyone who help me to do this. Please Help!

1 Answers

The problem is that you use MSVC-build of Qt and not the MinGW one. Update your CMakeLists.txt file:

set(CMAKE_PREFIX_PATH $ENV{QTDIR})

the environment variable QTDIR is set to Qt MinGW path (e.g. D:\Qt\6.2.3\mingw_64).

Don't forget to add the corresponding directory bin (%QTDIR%\bin) to the path environment variable.

Related