Planned maintenance has been done but it did not solve the problem. So work will continue on this and a new time for trying updates will be announced asap.

QtCreator autocompletion with CMakeLists.txt and external library

  • Dear Qt forum

    Since some months I'm using QtCreator 3.6.0 in combination with c++ and cmake/CMakeLists.txt
    I love that it is so easy to use but spent many hours to get autocompletion working within QtCreator and was still not able to achieve autocompletion when including an external library.
    The header files are not found when including them like #include <external/library/header.h>. And therefore the the autocompletion is not working.

    The library is linked with the project within the CMakeLists.txt and the project builds! But no autocompletion/found headers.

    Here my CMakeLists.txt. Marked the lines where I include the external library with -->, i.e include_directories() and target_link_libraries():

    cmake_minimum_required(VERSION 2.8.3)
    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
    find_package(catkin REQUIRED COMPONENTS
      --> /absolute/path/to/library/include 
       --> /absolute/path/to/external/
    target_link_libraries(${PROJECT_NAME}  myLibrary)

    What kind of path or variable to I have to set for QtCreator in the CMakeLists.txt that the header files from the external library are found when including them like:
    #include <external/library/header.h>
    And therefore the autocompletion is working?

    Thank you very much for your help.

    Best regards, Jonas

  • I am having the same problem, this time with QtCreator 4.1.0. Did you ever find a solution?