簡體   English   中英

Qt Creator + CMake 不解析文件

[英]Qt Creator + CMake not parsing files

我正在嘗試設置 CMake 和 Qt。 然而,即使是一個簡單的新項目也無法解析。 我嘗試了此處提供的解決方案,但沒有骰子。 日志好像提示查找jom.exe有問題,所以我也在PATH變量中添加了相關路徑。

CMakeLists.txt:

cmake_minimum_required(VERSION 3.5)

project(CMake_test LANGUAGES CXX)

set(CMAKE_INCLUDE_CURRENT_DIR ON)

set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)

set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

find_package(Qt5 COMPONENTS Widgets REQUIRED)

add_executable(CMake_test
  main.cpp
  mainwindow.cpp
  mainwindow.h
  mainwindow.ui
)

target_link_libraries(CMake_test PRIVATE Qt5::Widgets)

CMakeLists.txt( 修改):

file(GLOB SRC . *.cpp)
add_executable(CMake_test ${SRC})

CMakeError.log

Determining if the CXX compiler works failed with the following output:
Change Dir: C:/Users/xips/AppData/Local/Temp/QtCreator-JKugQb/qtc-cmake-MpAHVTrV/CMakeFiles/CMakeTmp

Run Build Command(s):jom /nologo cmTC_b431b\fast && The system cannot find the file specified
Generator: execution of make failed. Make command was: jom /nologo cmTC_b431b\fast && 

Determining if the CXX compiler works failed with the following output:
Change Dir: C:/Users/xips/AppData/Local/Temp/QtCreator-JKugQb/qtc-cmake-MpAHVTrV/CMakeFiles/CMakeTmp

Run Build Command(s):jom /nologo cmTC_b7633\fast && The system cannot find the file specified
Generator: execution of make failed. Make command was: jom /nologo cmTC_b7633\fast && 

Determining if the CXX compiler works failed with the following output:
Change Dir: C:/Users/xips/AppData/Local/Temp/QtCreator-JKugQb/qtc-cmake-MpAHVTrV/CMakeFiles/CMakeTmp

Run Build Command(s):jom /nologo cmTC_cfa37\fast && The system cannot find the file specified
Generator: execution of make failed. Make command was: jom /nologo cmTC_cfa37\fast && 

Determining if the CXX compiler works failed with the following output:
Change Dir: C:/Users/xips/AppData/Local/Temp/QtCreator-JKugQb/qtc-cmake-MpAHVTrV/CMakeFiles/CMakeTmp

Run Build Command(s):jom /nologo cmTC_33aea\fast && The system cannot find the file specified
Generator: execution of make failed. Make command was: jom /nologo cmTC_33aea\fast && 

Determining if the CXX compiler works failed with the following output:
Change Dir: C:/Users/xips/AppData/Local/Temp/QtCreator-JKugQb/qtc-cmake-MpAHVTrV/CMakeFiles/CMakeTmp

Run Build Command(s):jom /nologo cmTC_44869\fast && The system cannot find the file specified
Generator: execution of make failed. Make command was: jom /nologo cmTC_44869\fast && 

CMakeOutput.log

The system is: Windows - 10.0.18362 - AMD64
Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" succeeded.
Compiler: D:/Tools/Programming/Visual Studio/2019/Community/VC/Tools/MSVC/14.24.28314/bin/HostX64/x64/cl.exe 
Build flags: 
Id flags:  

The output was: 
0
Microsoft (R) C/C++ Optimizing Compiler Version 19.24.28316 for x64

CMakeCXXCompilerId.cpp
Microsoft (R) Incremental Linker Version 14.24.28316.0

/out:CMakeCXXCompilerId.exe 
CMakeCXXCompilerId.obj 


Compilation of the CXX compiler identification source "CMakeCXXCompilerId.cpp" produced "CMakeCXXCompilerId.exe"

Compilation of the CXX compiler identification source "CMakeCXXCompilerId.cpp" produced "CMakeCXXCompilerId.obj"

The CXX compiler identification is MSVC, found in "C:/Users/xips/AppData/Local/Temp/QtCreator-JKugQb    /qtc-cmake-MpAHVTrV/CMakeFiles/3.15.3/CompilerIdCXX/CMakeCXXCompilerId.exe"

Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" succeeded.
Compiler: D:/Tools/Programming/Visual Studio/2019/Community/VC/Tools/MSVC/14.24.28314/bin/HostX64/x64/cl.exe 
Build flags: /DWIN32;/D_WINDOWS;/W3;/GR;/EHsc
Id flags:  

The output was:
0
Microsoft (R) C/C++ Optimizing Compiler Version 19.24.28316 for x64

CMakeCXXCompilerId.cpp
Microsoft (R) Incremental Linker Version 14.24.28316.0

/out:CMakeCXXCompilerId.exe 
CMakeCXXCompilerId.obj 


Compilation of the CXX compiler identification source "CMakeCXXCompilerId.cpp" produced "CMakeCXXCompilerId.exe"

Compilation of the CXX compiler identification source "CMakeCXXCompilerId.cpp" produced "CMakeCXXCompilerId.obj"

The CXX compiler identification is MSVC, found in "C:/Users/xips/AppData/Local/Temp/QtCreator-JKugQb/qtc-cmake-MpAHVTrV/CMakeFiles/3.15.3/CompilerIdCXX/CMakeCXXCompilerId.exe"

Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" succeeded.
Compiler: D:/Tools/Programming/Visual Studio/2019/Community/VC/Tools/MSVC/14.24.28314/bin/HostX64/x64/cl.exe 
Build flags: /DWIN32;/D_WINDOWS;/W3;/GR;/EHsc
Id flags:  

The output was:
0
Microsoft (R) C/C++ Optimizing Compiler Version 19.24.28316 for x64

CMakeCXXCompilerId.cpp
Microsoft (R) Incremental Linker Version 14.24.28316.0

/out:CMakeCXXCompilerId.exe 
CMakeCXXCompilerId.obj 


Compilation of the CXX compiler identification source "CMakeCXXCompilerId.cpp" produced "CMakeCXXCompilerId.exe"

Compilation of the CXX compiler identification source "CMakeCXXCompilerId.cpp" produced "CMakeCXXCompilerId.obj"

The CXX compiler identification is MSVC, found in "C:/Users/xips/AppData/Local/Temp/QtCreator-JKugQb/qtc-cmake-MpAHVTrV/CMakeFiles/3.15.3/CompilerIdCXX/CMakeCXXCompilerId.exe"

Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" succeeded.
Compiler: D:/Tools/Programming/Visual Studio/2019/Community/VC/Tools/MSVC/14.24.28314/bin/HostX64/x64/cl.exe 
Build flags: /DWIN32;/D_WINDOWS;/W3;/GR;/EHsc
Id flags:  

The output was:
0
Microsoft (R) C/C++ Optimizing Compiler Version 19.24.28316 for x64

CMakeCXXCompilerId.cpp
Microsoft (R) Incremental Linker Version 14.24.28316.0

/out:CMakeCXXCompilerId.exe 
CMakeCXXCompilerId.obj 


Compilation of the CXX compiler identification source "CMakeCXXCompilerId.cpp" produced "CMakeCXXCompilerId.exe"

Compilation of the CXX compiler identification source "CMakeCXXCompilerId.cpp" produced "CMakeCXXCompilerId.obj"

The CXX compiler identification is MSVC, found in "C:/Users/xips/AppData/Local/Temp/QtCreator-JKugQb/qtc-cmake-MpAHVTrV/CMakeFiles/3.15.3/CompilerIdCXX/CMakeCXXCompilerId.exe"

Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" succeeded.
Compiler: D:/Tools/Programming/Visual Studio/2019/Community/VC/Tools/MSVC/14.24.28314/bin/HostX64/x64/cl.exe 
Build flags: /DWIN32;/D_WINDOWS;/W3;/GR;/EHsc
Id flags:  

The output was:
0
Microsoft (R) C/C++ Optimizing Compiler Version 19.24.28316 for x64

CMakeCXXCompilerId.cpp
Microsoft (R) Incremental Linker Version 14.24.28316.0

/out:CMakeCXXCompilerId.exe 
CMakeCXXCompilerId.obj 


Compilation of the CXX compiler identification source "CMakeCXXCompilerId.cpp" produced "CMakeCXXCompilerId.exe"

Compilation of the CXX compiler identification source "CMakeCXXCompilerId.cpp" produced "CMakeCXXCompilerId.obj"

The CXX compiler identification is MSVC, found in "C:/Users/xips/AppData/Local/Temp/QtCreator-JKugQb/qtc-cmake-MpAHVTrV/CMakeFiles/3.15.3/CompilerIdCXX/CMakeCXXCompilerId.exe"

好吧,我(有點客氣)弄清楚出了什么問題。 將 jom.exe 添加到 PATH 變量后,我重新啟動了計算機和 Qt - 但是,它仍然無法正常工作。 然后我發布了我的問題。 過了一會兒,我再次打開 Qt,項目解析成功。

然后我仍然必須處理錯誤“必須為構建設置 CMake 工具。在套件選項中配置 CMake 工具”。 但這也可以通過再次關閉和打開 Qt 來解決。

從那時起,構建和運行任何項目都沒有錯誤。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM