Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Including header breaks project
Forum Updated to NodeBB v4.3 + New Features

Including header breaks project

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 2 Posters 196 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.
  • R Offline
    R Offline
    Redman
    wrote on last edited by
    #1

    <Bar> is qt module I had to built from source.

    In Foo.h I include <Bar>. The project compiles.

    In Baz.h I include Foo.h. The project breaks.

    Foo.h and Baz.h are part of the same qt_add_qml_module()

    CMakeLists.txt

    qt_add_qml_module(${PROJECT_NAME} STATIC
        URI core.app
        VERSION 1.0
        RESOURCE_PREFIX core/imports
        SOURCES
            src/plc/Bar.cpp
            src/plc/Bar.h
            src/plc/Foo.cpp
            src/plc/Foo.h
        DEPENDENCIES QtQuick
    )
    
    ... 
    
    target_link_libraries(${PROJECT_NAME} PRIVATE
        Qt${QT_VERSION_MAJOR}::Core
        Qt${QT_VERSION_MAJOR}::Quick
        Qt${QT_VERSION_MAJOR}::Bar
    )
    

    Care to help?

    Christian EhrlicherC 1 Reply Last reply
    0
    • Christian EhrlicherC Christian Ehrlicher

      @Redman said in Including header breaks project:

      The project breaks.

      What does this mean?

      R Offline
      R Offline
      Redman
      wrote on last edited by Redman
      #3

      @Christian-Ehrlicher I should've clarified that.

      In Foo.h I include <Bar>. The <Bar> is found because it is provided by a qt module.

      In Baz.h I include Foo.h. The <Bar> is NOT found anymore. Telling me it's not found in Foo.h.

      Since this is a qt module, I do not have to provide an includepath via target_include_directories(). Just to see if it would've worked -> it did not. Not even explicitly telling cmake where to find the header worked

      Edit: Sleeping makes wonders!
      Baz.h is included in a different target which did not link against the specific qt module.

      1 Reply Last reply
      0
      • R Redman

        <Bar> is qt module I had to built from source.

        In Foo.h I include <Bar>. The project compiles.

        In Baz.h I include Foo.h. The project breaks.

        Foo.h and Baz.h are part of the same qt_add_qml_module()

        CMakeLists.txt

        qt_add_qml_module(${PROJECT_NAME} STATIC
            URI core.app
            VERSION 1.0
            RESOURCE_PREFIX core/imports
            SOURCES
                src/plc/Bar.cpp
                src/plc/Bar.h
                src/plc/Foo.cpp
                src/plc/Foo.h
            DEPENDENCIES QtQuick
        )
        
        ... 
        
        target_link_libraries(${PROJECT_NAME} PRIVATE
            Qt${QT_VERSION_MAJOR}::Core
            Qt${QT_VERSION_MAJOR}::Quick
            Qt${QT_VERSION_MAJOR}::Bar
        )
        

        Care to help?

        Christian EhrlicherC Offline
        Christian EhrlicherC Offline
        Christian Ehrlicher
        Lifetime Qt Champion
        wrote on last edited by
        #2

        @Redman said in Including header breaks project:

        The project breaks.

        What does this mean?

        Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
        Visit the Qt Academy at https://academy.qt.io/catalog

        R 1 Reply Last reply
        0
        • Christian EhrlicherC Christian Ehrlicher

          @Redman said in Including header breaks project:

          The project breaks.

          What does this mean?

          R Offline
          R Offline
          Redman
          wrote on last edited by Redman
          #3

          @Christian-Ehrlicher I should've clarified that.

          In Foo.h I include <Bar>. The <Bar> is found because it is provided by a qt module.

          In Baz.h I include Foo.h. The <Bar> is NOT found anymore. Telling me it's not found in Foo.h.

          Since this is a qt module, I do not have to provide an includepath via target_include_directories(). Just to see if it would've worked -> it did not. Not even explicitly telling cmake where to find the header worked

          Edit: Sleeping makes wonders!
          Baz.h is included in a different target which did not link against the specific qt module.

          1 Reply Last reply
          0
          • R Redman has marked this topic as solved on

          • Login

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