sudo apt-get -y install build-essential cmake valgrind gdb
官方鏡像:USTC Mirror
推薦 2.8 系列 (基於 Qt4,Fcitx 相容性最佳):
qt-creator-linux-x86_64-opensource-2.8.1.run (~60 MB)
chmod +x qt-creator-linux-x86_64-opensource-2.8.1.run
./qt-creator-linux-x86_64-opensource-2.8.1.run
# 選擇安裝目錄 (可放 ~/opt/qtcreator-2.8.1)
sudo apt-get install fcitx-frontend-qt5
ln -s /usr/lib/$(arch)-linux-gnu/qt5/plugins/platforminputcontexts/libfcitxplatforminputcontextplugin.so \
~/opt/qtcreator-3.x/bin/plugins/platforminputcontexts/
# 重啟 Qt Creator
~/opt/qtcreator-2.8.1/bin/qtcreator -settingspath ~/opt/qtcreator-2.8.1
Tools → Options → Environment → Keyboard → 搜尋 "Ctrl+Space" → 刪除 → 新增 "Alt+/" 或 "Shift+Return"。
Tools → Options → Environment → External Tools → Add → 命令:konsole -e vim "%{CurrentDocument:FilePath}" (GNOME 用 gnome-terminal -x)。
/usr/bin/konsole -e 或 /usr/bin/gnome-terminal -x# 臨時
sudo sysctl kernel.yama.ptrace_scope=0
# 永久
echo "kernel.yama.ptrace_scope = 0" | sudo tee /etc/sysctl.d/10-ptrace.conf
sudo sysctl -p
| 類型 | 建立方式 | 建構系統 | 適用場景 |
|---|---|---|---|
| Qt Widgets / Quick | File → New → Qt Widgets Application | qmake (.pro) | Qt GUI 專案 |
| 非 Qt CMake 專案 | File → New → Non-Qt Project → CMake Project | CMake (自動生成 Makefile) | 現代 C++ 庫/服務,跨平台 |
| 導入現有 Makefile 專案 | File → New → Import → Import Existing Project | Make (需自備 Makefile) | 舊專案、Nginx、Linux 核心模組 |
| 導入 CMake 專案 | File → Open → 選 CMakeLists.txt | CMake | 已有 CMake 專案 |
Projects → Build → Build Steps → Run CMake → Arguments 加入:
-DCMAKE_BUILD_TYPE=Debug (或 RelWithDebInfo),否則無調試符號。