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. Not compiling files in project
Forum Updated to NodeBB v4.3 + New Features

Not compiling files in project

Scheduled Pinned Locked Moved Solved General and Desktop
6 Posts 4 Posters 1.2k Views 3 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.
  • B Offline
    B Offline
    BrianE
    wrote on 2 May 2018, 17:20 last edited by
    #1

    One of my projects has lots of .cpp and .h files. Some of them are no longer needed but I want to keep them because they have useful methods and functions in them. Without removing them from the project, can I compile the project without them? What would I need to do to achieve this?

    K J 2 Replies Last reply 2 May 2018, 18:04
    0
    • B BrianE
      2 May 2018, 17:20

      One of my projects has lots of .cpp and .h files. Some of them are no longer needed but I want to keep them because they have useful methods and functions in them. Without removing them from the project, can I compile the project without them? What would I need to do to achieve this?

      K Offline
      K Offline
      koahnig
      wrote on 2 May 2018, 18:04 last edited by
      #2

      @BrianE

      Looks like a strange concept to me.

      A project is defined as a bunch of files you like or have to compile for creation of a library or an executable.
      When you do not want to put a compiled into a lib or exe, just remove them from the project file. You can leave them where they are, but they are no longer compiled and not linked to your lib/app.

      If you have just a couple of files, it does not really matter. When change quite a bit with large amounts of files, you might loose the overview soon. Therefore, it would be better to archive files somewhere save (e.g. use of git or somthing).

      Vote the answer(s) that helped you to solve your issue(s)

      1 Reply Last reply
      3
      • B BrianE
        2 May 2018, 17:20

        One of my projects has lots of .cpp and .h files. Some of them are no longer needed but I want to keep them because they have useful methods and functions in them. Without removing them from the project, can I compile the project without them? What would I need to do to achieve this?

        J Online
        J Online
        JonB
        wrote on 2 May 2018, 19:53 last edited by
        #3

        @BrianE
        I would have thought you could use https://forum.qt.io/topic/74990/exclude-source-from-build principle to achieve what you want?

        1 Reply Last reply
        0
        • S Offline
          S Offline
          SGaist
          Lifetime Qt Champion
          wrote on 2 May 2018, 19:59 last edited by
          #4

          Hi,

          If you really want to keep them visible, you can put them under OTHER_FILES. Qt Creator will show them but they won't get built.

          However, as @koahnig suggest, it's better to remove dead code that's going to rot and have the in your VCS if you need them at some point.

          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
          2
          • B Offline
            B Offline
            BrianE
            wrote on 2 May 2018, 23:05 last edited by
            #5

            Thanks Guys!

            I hadn't spotted the Remove File... menu entry and that does what I want. That leaves my files within the project directory but not in the project itself, which is what I wanted, ie to preserve the functions for their possible reuse in later projects but not this one any longer. One day I'll work out how to do Libraries in Qt - I used them when I was programming with Borland's Builder.

            K 1 Reply Last reply 3 May 2018, 07:12
            0
            • B BrianE
              2 May 2018, 23:05

              Thanks Guys!

              I hadn't spotted the Remove File... menu entry and that does what I want. That leaves my files within the project directory but not in the project itself, which is what I wanted, ie to preserve the functions for their possible reuse in later projects but not this one any longer. One day I'll work out how to do Libraries in Qt - I used them when I was programming with Borland's Builder.

              K Offline
              K Offline
              koahnig
              wrote on 3 May 2018, 07:12 last edited by
              #6

              @BrianE

              No problem.

              Certainly the "Remove FIle" is an option. However, personally I prefer simply editing the project *.pro or its includes and do a rerun of qmake in Qt creator to make sure. The nice part there is also that you can use the "comment" key strokes and mark sections for temporary removal of files from a project.

              Vote the answer(s) that helped you to solve your issue(s)

              1 Reply Last reply
              0

              1/6

              2 May 2018, 17:20

              • Login

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