Qt 5环境配置疑问:CMake与调试器缺失问题求助
Hey there! I’ve dealt with this exact issue when setting up Qt 5.10 Community Edition before—let’s break down what’s likely going on and how to resolve it.
1. First: Check if you missed components during installation
Qt’s installer doesn’t enable all developer tools by default, which is probably why you’re missing CMake and debuggers. Here’s how to fix that:
- Relaunch the Qt Installer, select the Modify option for your existing Qt 5.10 installation.
- Expand the compiler kit you’re using (e.g.,
MinGW 5.3.0 32-bitorMSVC 2017 64-bit), and make sure the Debug Tools sub-component is checked (this includes the debugger for that kit). - Navigate to the
Developer and Designer Toolscategory, find the CMake entry, and ensure it’s selected. - Click Apply to install the missing components.
2. If components are installed but Qt Creator doesn’t detect them: Manually configure
Sometimes Qt Creator fails to auto-detect tools even after installation. Here’s how to add them manually:
Adding a debugger
- Open Qt Creator, go to
Tools > Options > Kits > Debuggers. - Click the Add button, then browse to the debugger executable:
- For MinGW on Windows: Look in
Qt\5.10.0\mingw53_32\bin\gdb.exe(adjust the path to match your kit’s architecture). - For MSVC on Windows: Find it in
C:\Program Files (x86)\Windows Kits\10\Debuggers\x64\cdb.exe(or the corresponding path for your Windows SDK version). - On Linux: Use
/usr/bin/gdb. - On macOS: Use
/usr/bin/lldb.
- For MinGW on Windows: Look in
- Name the debugger something recognizable (e.g., "MinGW 5.3 GDB") and click OK.
Adding CMake
- Go to
Tools > Options > Build & Run > CMake. - Click Add, then navigate to the CMake executable:
- On Windows: It’s usually in
Qt\Tools\CMake\bin\cmake.exe. - On Linux/macOS: Check the
Qt/Tools/CMake/bindirectory under your Qt installation path.
- On Windows: It’s usually in
- Name it (e.g., "Qt CMake 3.x") and save.
3. Verify your Kit configuration
Finally, make sure your active kit is using the tools you just added:
- Go to
Tools > Options > Kits > Kits. - Select the kit you want to use (e.g., "Desktop Qt 5.10.0 MinGW 32-bit").
- In the Debugger dropdown, pick the debugger you added earlier.
- For CMake projects, when you set up a new project, Qt Creator will use the CMake you configured—you can confirm this in the project’s
Build Settingstab.
内容的提问来源于stack exchange,提问作者Raji Birru
相关产品推荐
相关产品推荐

