Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. QtCreator autocompletion with CMakeLists.txt and external library

QtCreator autocompletion with CMakeLists.txt and external library

Scheduled Pinned Locked Moved Unsolved Installation and Deployment
qtcreator 3.6.0cmakec++cmakelists.txtautocomplete
2 Posts 2 Posters 2.3k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    jonasei
    wrote on 15 Mar 2016, 12:39 last edited by
    #1

    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)
    project(line_tracking)
    
    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
    
    find_package(catkin REQUIRED COMPONENTS
      roscpp
    )
    
    catkin_package()
    
    include_directories(
      include
      ${catkin_INCLUDE_DIRS}
      ${PROJECT_SOURCE_DIR}
      --> /absolute/path/to/library/include 
    )
    
    add_library(myLibrary
        src/SomeClasses.cpp
    )
    target_link_libraries(myLibrary
        ${catkin_LIBRARIES}
       --> /absolute/path/to/external/library.so
    )
    
    add_executable(${PROJECT_NAME}
        src/line_tracking.cpp
    )
    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

    1 Reply Last reply
    1
    • D Offline
      D Offline
      daviddoria
      wrote on 16 Nov 2016, 20:03 last edited by
      #2

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

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved