QtCreator建立CMake工程

2021-08-27 18:14:18 字數 1717 閱讀 7289

確保cmake已經安裝並且新增到了系統環境變數(qtcreator會自動檢測),或者qtcreator中手動新增。如果使用vs編譯器的話,需要準備:

1、vs已經安裝。

2、win10 sdk(本人使用的是win10)已經安裝。

3、將d:\qt\qt5.9.6\tools\qtcreator\bin(根據自己的實際情況)新增到系統環境變數,不然會報錯:

starting to parse cmake project, using: "-dcmake_cxx_compiler:string=d:/vs2015/vc/bin/amd64_x86/cl.exe", "-dcmake_c_compiler:string=d:/vs2015/vc/bin/amd64_x86/cl.exe", "-dcmake_prefix_path:string=d:/qt/qt5.9.6/5.9.6/msvc2015", "-dqt_qmake_executable:string=d:/qt/qt5.9.6/5.9.6/msvc2015/bin/qmake.exe".

the c compiler identification is msvc 19.0.24210.0

the cxx compiler identification is msvc 19.0.24210.0

check for working c compiler: d:/vs2015/vc/bin/amd64_x86/cl.exe

cmake error: generator: execution of make failed. make command was: "jom" "/nologo" "cmtc_9a64b\fast"

check for working c compiler: d:/vs2015/vc/bin/amd64_x86/cl.exe -- broken

cmake error at d:/tools/cmake-3.11.0-rc3-win64-x64/cmake-3.11.0-rc3-win64-x64/share/cmake-3.11/modules/cmaketestccompiler.cmake:52 (message):

the c compiler

"d:/vs2015/vc/bin/amd64_x86/cl.exe"

is not able to compile a ****** test program.

it fails with the following output:

run build command:"jom" "/nologo" "cmtc_9a64b\fast"

系統找不到指定的檔案。

generator: execution of make failed. make command was: "jom" "/nologo" "cmtc_9a64b\fast"

cmake will not be able to correctly generate this project.

call stack (most recent call first):

cmakelists.txt:3 (project)

configuring incomplete, errors occurred!

cmake project parsing failed.

其餘步驟與mingw一致。

vscode在UBUNTU下使用CMAKE編譯

開啟乙個含有cmakelists.txt的資料夾 在.vscode要建立三個json檔案才能對cmake工程進行編譯和除錯,分別是c cpp properties.json,launch.json和tasks.json c cpp properties.json檔案 ctrl shift p,輸入c...

QT Creator使用共享庫(一)建立共享庫

最近使用qt的移動裝置要呼叫個加密的.so,在前人 上折騰了n久也沒出來,終於自己照著幫助一步步作了一下,在此記下一筆。使用的工具 qt creator 測試環境 win 7,qt平台的外設 首先我們寫個共享的庫檔案 1.建立c 庫,選擇共享庫 2.在標頭檔案裡加上個方法,並在自動生成的類裡也加上個...

如何優雅的公升級自己Ubuntu的CMake

有時候在編譯東西的時候,會發現自己的cmake版本太低,比如下面這種情況 然後就上網搜各種教程,搜到 sudo apt get autoremove cmake,然後得到這種情況 你如果不細看的話,就將你之前編譯過的ros等其他包都刪掉了。細思極恐。萬一看都不看直接y了,可有的你後悔。1 insta...