Results 1 to 2 of 2

Thread: Cmake-C++-Project: Includes in header files not found by the preprocessor

  1. #1

    Default Cmake-C++-Project: Includes in header files not found by the preprocessor

    Hello,

    I have the following problem:

    I got a new computer and installed everything to continue working on an open source project. The project itself is a CMake project in C++. The data is located in a path like the following:

    ProjectDir/src/SomeName

    In the main CMakeFile, located in "ProjectDir", we have the line:

    INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/src)

    So we can write something like

    #include "SomeName/AFile.h"

    Basically we get rid of the "src" in all the include-paths. This was working fine on other computers but now I have the problem, that QtCreator underlines every include and when hovering the mouse over it, it says: "No such file or directory".
    I can compile the code without any issues, but the problem is, that the automatic code completion does not work anymore, which is really annoying. This error only occurs in header files. In cpp files, everything is fine. If I type the full path (with "src"), then Qt creator finds the included headers, but then it does not compile anymore, because the projects root directory is not meant to be an include directory. Is this some kind of bug in the current version or have I messed up some configurations?

    My QtCreator version is 4.1

    Greetings

  2. #2
    Join Date
    May 2008
    Posts
    20
    Thanks
    1

    Default Re: Cmake-C++-Project: Includes in header files not found by the preprocessor

    I have exactly the same problem using QtCreator 4.1.0. The project builds fine, but the parser can't find some of my 3rd party library includes so auto-completion doesn't work. I even very explicitly wrote (in the subdirectory's CMakeList.txt where the problem is occuring):

    include_directories(/home/doria/build/HDR-EXT/Install/include/eigen3)

    and then when I check the code model that path is not in the "Project Parts -> Header Paths"

Similar Threads

  1. Adding C++ standard header files to the project
    By swarupa in forum General Programming
    Replies: 2
    Last Post: 15th February 2016, 14:35
  2. Qt Creator Adding files to cmake project
    By xadian in forum Qt Tools
    Replies: 1
    Last Post: 1st April 2013, 15:18
  3. Creating Library which includes QML files
    By arunpk in forum Qt Programming
    Replies: 0
    Last Post: 10th September 2012, 11:19
  4. Generated UI header incorrectly includes class header?
    By droneone in forum Qt Programming
    Replies: 7
    Last Post: 14th June 2012, 14:48
  5. Environment variables in project .includes?
    By Karmaflute in forum Qt Tools
    Replies: 4
    Last Post: 26th November 2009, 00:59

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.