我有一个恼人的问题与QT(版本5.12.1),我怀疑这是因为我有几个不同版本的Visual Studio也在我的机器上活动。请注意,我正在使用windows 10和QT创建者工作。问题如下:
创建新的空控制台项目时,IDE中出现以下常规消息:
正在运行Windows运行时设备检测。未找到winrtrunner.exe。C:/Qt/Qt5.12.1/5.12.1/mingw73_64/mkspecs/features/toolchain.prf(76):变量QMAKE_CXX.COMPILER_MACROS未定义。项目错误:无法解析编译器输出中的默认搜索路径解析文件C:\Qt\Test\Proj\Proj. pro时出错。正在放弃。
当创建一个控制台项目时,QT将默认添加main.cpp。但是,我不能添加任何新的源代码文件(这些选项是灰色的),而且我实际上不能访问main.cpp。
但是如果我构建项目(通过IDE),它会生成一个.o和.exe文件,这是没有意义的,因为我无法向源代码中添加任何内容。然后,我关闭QT,打开它,它就像它应该的那样工作。
我使用的是MinGW,但是QT仍然可以自动检测MSVC编译器和调试器。这应该不会引起任何问题,因为默认的构建工具包指定了所有的MinGW内容。
有什么想法的原因可能是什么?所有的在线搜索,我做了指向错误被记录和修复的QT5.9,但没有明确的解决方案,我的问题。
1条答案
按热度按时间hc8w905p1#
We were having the same problem building on Windows 10, and I think I found a solution. Our project is compiling our Qt project with both Visual Studio 2019 (using the MSVC compiler), and with Qt 5.12.7 (using a MinGW 64bit compiler).
We had a pretty big refactor, so I deleted build directories and *pro.user files. Then I had the same thing happen to our Qt projects. I also created a default project, closed Qt and when I restarted it, I could not parse the *.pro file with the same error you saw. After some investigation, I restored .qmake.stash files that I had deleted (from the Recycle Bin) and the build started working again.
What I pieced out is that Qt depends on qmake running (This bug was supposed to be fixed: https://bugreports.qt.io/browse/QTBUG-60059 , but I decided to focus on qmake). After a bunch of trial and error (without a good explanation of why it work), I found a solution.
I got this procedure to work a few times.
Also, as long as you don't blow away all the build artifacts while QtCreator is closed, opening the project seems to work find. You can blow away all the artifacts while QtCreator is open, and then rebuild before closing and everthing works ok.