Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. Header- and Sourcecode Files integration in a main Programm
Forum Updated to NodeBB v4.3 + New Features

Header- and Sourcecode Files integration in a main Programm

Scheduled Pinned Locked Moved Solved Qt Creator and other tools
6 Posts 2 Posters 487 Views 1 Watching
  • 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.
  • DietmarRTD Offline
    DietmarRTD Offline
    DietmarRT
    wrote on last edited by
    #1

    Hello everyone,
    I'm new to Qt Creator and I have a 'small' problem.
    On (OpenSuse) Linux, I'm using Creator 9.0.2 and I want to subdivide my main program (via #include)
    and integrate one or more separate *.hpp file(s).
    When I create a new project (Qt console application), a main.cpp file is always created under the correct project name.
    Questions:

    1. How do I create an hpp file? (new project?)
    2. How do I create the associated cpp file? (new project?)
    3. Where do I have to save the hpp and cpp files so that the project/main program can integrate them?
    4. Is it possible to integrate these additional source files when creating the project?
    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi and welcome to devnet,

      There's no need to create new projects for these files. From your description it seems you want to create new classes so go that route and your project should be automatically updated.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      1
      • DietmarRTD Offline
        DietmarRTD Offline
        DietmarRT
        wrote on last edited by
        #3

        Hi SGaist,
        i would like to use more than #include <iostream>. I would like to define my own #include "character.cpp".
        Together with this ".cpp" i need a ".hpp" too but how can i crete them with Qt and how can i put this files in my projekt?

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by SGaist
          #4

          You know that Qt is just a C++ framework. There's nothing special here. If you want to have Qt Creator help you create new files, there's a menu for that under File.

          Qt Creator -> File -> New File -> Select C++ Class, fill the information and you will have a pair of C++ header/implementation files created and added to your project.

          Otherwise, you can create these files manually as you would any other and then manually update your project file.
          Qt Creator has a pretty extensive documentation worth reading.

          Two things to take into account:

          • Qt 6 has moved to CMake for project management. While qmake is still supported, it's not recommended to start new projects with it.
          • Qt Creator 9 is pretty old, you should maybe consider getting a more recent version which also has better cmake support.

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          1
          • DietmarRTD Offline
            DietmarRTD Offline
            DietmarRT
            wrote on last edited by
            #5

            hi SGaist,
            thank you for your information. I have createt the files (.hpp & .cpp) manually and try to make my projekt bugless.

            1 Reply Last reply
            0
            • DietmarRTD DietmarRT has marked this topic as solved on
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

              Don't hesitate to open new topics if other issues arise.

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              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