Skip to content

using neovim instead of qtcreator

Using neovim instead of qtcreator

links: - https://stackoverflow.com/questions/19206462/compile-a-qt-project-from-command-line - https://doc.qt.io/qt-6/cmake-build-on-cmdline.html#:~:text=To%20build%20a%20Qt%20project,you%20will%20need%20to%20set. - https://doc.qt.io/qtcreator/creator-preferences-cpp-clangd.html

Create the project in qt creator

> Build
    > Run Generator
        > Generate Compilation Database

This generates a compile_commands.json file which you can, which you can find in in General Messages

[cmake] Running /usr/bin/cmake -S /home/vector/applications/qt/untitled -B /home/vector/applications/qt/untitled/build/Desktop-Debug -DCMAKE_PROJECT_INCLUDE_BEFORE:FILEPATH=/home/vector/applications/qt/untitled/build/Desktop-Debug/.qtc/package-manager/auto-setup.cmake -DCMAKE_BUILD_TYPE:STRING=Debug -DCMAKE_CXX_FLAGS_INIT:STRING=-DQT_QML_DEBUG -DCMAKE_PREFIX_PATH:PATH=/usr -DCMAKE_COLOR_DIAGNOSTICS:BOOL=ON -DCMAKE_GENERATOR:STRING=Ninja -DCMAKE_CXX_COMPILER:FILEPATH=/usr/bin/g++ -DCMAKE_C_COMPILER:FILEPATH=/usr/bin/clang -DQT_QMAKE_EXECUTABLE:FILEPATH=/usr/bin/qmake in /home/vector/applications/qt/untitled/build/Desktop-Debug.
[cmake] -- The CXX compiler identification is GNU 14.2.1
[cmake] -- Detecting CXX compiler ABI info
[cmake] -- Detecting CXX compiler ABI info - done
[cmake] -- Check for working CXX compiler: /usr/bin/g++ - skipped
[cmake] -- Detecting CXX compile features
[cmake] -- Detecting CXX compile features - done
[cmake] -- Performing Test CMAKE_HAVE_LIBC_PTHREAD
[cmake] -- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
[cmake] -- Found Threads: TRUE
[cmake] -- Performing Test HAVE_STDATOMIC
[cmake] -- Performing Test HAVE_STDATOMIC - Success
[cmake] -- Found WrapAtomic: TRUE
[cmake] -- Configuring done (0.7s)
[cmake] -- Generating done (0.0s)
[cmake] -- Build files have been written to: /home/vector/applications/qt/untitled/build/Desktop-Debug
[cmake] 
[cmake] Elapsed time: 00:01.
Generating compilation database for Clang-Tidy at "/tmp/QtCreator-EXfoLO/Clang-TidyOBVHXa" ...
Compilation database for Clang-Tidy successfully generated at "/tmp/QtCreator-EXfoLO/Clang-TidyOBVHXa".
Generating compilation database for Clazy at "/tmp/QtCreator-EXfoLO/ClazyyvyIAX" ...
Compilation database for Clazy successfully generated at "/tmp/QtCreator-EXfoLO/ClazyyvyIAX".
Clang compilation database generated at "/home/vector/applications/qt/untitled/build/Desktop-Debug/compile_commands.json".
Clang compilation database generated at "/home/vector/applications/qt/untitled/build/Desktop-Debug/compile_commands.json".

Copy compile_commands.json to the root of your project

cp /home/vector/applications/qt/untitled/build/Desktop-Debug/compile_commands.json /home/vector/applications/qt/untitled

Setup up clangd

local capabilities = require('blink.cmp').get_lsp_capabilities()
require 'lspconfig'.clangd.setup {
  capabilities = capabilities,
}

Remove warning

https://github.com/clangd/clangd/issues/662


Comments