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. How to modify .pro after changing the path of .h and .cpp files
QtWS25 Last Chance

How to modify .pro after changing the path of .h and .cpp files

Scheduled Pinned Locked Moved Unsolved General and Desktop
8 Posts 4 Posters 809 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.
  • G Offline
    G Offline
    Geng.Y
    wrote on last edited by
    #1

    Hi, I have a problem about .pro file.
    In order to manage the source files, I moved all the .h & .cpp files under project directory to ./src/ and the .pro changes automatically as follows. But when I tried to rebuild, it reminds that " 'renderingwidget.h' not found in ui_mainwindow.h". Could you help me figure out the cause?

    SOURCES += \
            src/main.cpp \
            src/mainwindow.cpp \
            src/renderingwidget.cpp
    
    HEADERS += \
            src/mainwindow.h \
            src/renderingwidget.h
    
    raven-worxR 1 Reply Last reply
    0
    • G Geng.Y

      Hi, I have a problem about .pro file.
      In order to manage the source files, I moved all the .h & .cpp files under project directory to ./src/ and the .pro changes automatically as follows. But when I tried to rebuild, it reminds that " 'renderingwidget.h' not found in ui_mainwindow.h". Could you help me figure out the cause?

      SOURCES += \
              src/main.cpp \
              src/mainwindow.cpp \
              src/renderingwidget.cpp
      
      HEADERS += \
              src/mainwindow.h \
              src/renderingwidget.h
      
      raven-worxR Offline
      raven-worxR Offline
      raven-worx
      Moderators
      wrote on last edited by
      #2

      @Geng.Y
      did you rerun qmake after the changes?

      --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
      If you have a question please use the forum so others can benefit from the solution in the future

      G 2 Replies Last reply
      1
      • raven-worxR raven-worx

        @Geng.Y
        did you rerun qmake after the changes?

        G Offline
        G Offline
        Geng.Y
        wrote on last edited by
        #3

        @raven-worx yes I tried.
        you mean run qmake and then build the project?
        It doesn't work

        1 Reply Last reply
        0
        • raven-worxR raven-worx

          @Geng.Y
          did you rerun qmake after the changes?

          G Offline
          G Offline
          Geng.Y
          wrote on last edited by
          #4

          @raven-worx
          0_1542741390433_Screen Shot 2018-11-20 at 2.16.03 PM.png

          J.HilkJ 1 Reply Last reply
          0
          • G Geng.Y

            @raven-worx
            0_1542741390433_Screen Shot 2018-11-20 at 2.16.03 PM.png

            J.HilkJ Offline
            J.HilkJ Offline
            J.Hilk
            Moderators
            wrote on last edited by J.Hilk
            #5

            @Geng.Y said in How to modify .pro after changing the path of .h and .cpp files:

            @raven-worx
            0_1542741390433_Screen Shot 2018-11-20 at 2.16.03 PM.png

            you‘ll have to change your includes inside the cpp and h files also,

            #include „renderingwidget.h“ to #include „src/renderingwidget.h“ or add the folders inside the pro file via the includepath makro

            this is necessary for all files that include files that are not in the folder


            Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


            Q: What's that?
            A: It's blue light.
            Q: What does it do?
            A: It turns blue.

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

              Hi,

              You can add INCLUDEPATH += $$PWD/src to your .pro file.

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

              G 1 Reply Last reply
              2
              • SGaistS SGaist

                Hi,

                You can add INCLUDEPATH += $$PWD/src to your .pro file.

                G Offline
                G Offline
                Geng.Y
                wrote on last edited by
                #7

                @SGaist
                Great! It works, thank you very much~

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

                  You're welcome !

                  Since you have it working now, please mark the thread as solved using the "Topic Tools" button so that other form users may know a solution has been found :)

                  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