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. [solved] Force Qt-creator to rebuild one cpp-file on every build
Forum Updated to NodeBB v4.3 + New Features

[solved] Force Qt-creator to rebuild one cpp-file on every build

Scheduled Pinned Locked Moved General and Desktop
buildqtcreator
5 Posts 3 Posters 2.9k 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.
  • J Offline
    J Offline
    JB Tristant
    wrote on 24 Jun 2015, 12:00 last edited by JB Tristant
    #1

    Hello,

    I use the __DATE__ & __TIME__ macro to get the compile date in the about dialog box. That file is not changed very often but I would like to update the date and time to every build.

    Is there a good way to force to re-build of that specific file regardless the changes in it in qt-creator ?

    Thank!

    1 Reply Last reply
    0
    • J Offline
      J Offline
      Jeroentjehome
      wrote on 24 Jun 2015, 12:48 last edited by
      #2

      Hi,
      Maybe use the creation date of the exe file? With the qApp->path you get the location of your program, then use the QFile on your exe file and read out the creation data.

      Greetz, Jeroen

      1 Reply Last reply
      0
      • L Offline
        L Offline
        Leonardo
        wrote on 24 Jun 2015, 12:52 last edited by Leonardo
        #3

        You could add a custom build step to delete the corresponding object files, before calling the compiler. Like this:

        Command: rm
        Arguments: -f filename.obj moc_filename.*
        Working directory: %{buildDir}

        Then the compiler will be forced to rebuild that file.

        1 Reply Last reply
        1
        • J Offline
          J Offline
          JB Tristant
          wrote on 24 Jun 2015, 13:39 last edited by
          #4

          Thanks guys,

          I follow your idea Leonardo, but on windows, I'm not able to use del in command...

          So I've create a .bat in the working directory with the line: del /Q filename.o moc_filename.*

          put the .bat in command and that's it.

          1 Reply Last reply
          0
          • L Offline
            L Offline
            Leonardo
            wrote on 24 Jun 2015, 13:59 last edited by Leonardo
            #5

            Hi. Just for the record, on Windows:

            Command: C:\Windows\System32\cmd.exe
            Arguments: /C "del filename.obj moc_filename.obj moc_filename.cpp"
            Working directory: %{buildDir}

            1 Reply Last reply
            1

            1/5

            24 Jun 2015, 12:00

            • Login

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