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. Qtcreator: adding .cpp and .h files that are already in the project results in double entries in the .pro file
Forum Updated to NodeBB v4.3 + New Features

Qtcreator: adding .cpp and .h files that are already in the project results in double entries in the .pro file

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 3 Posters 2.0k 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.
  • C Offline
    C Offline
    cdwijs
    wrote on last edited by
    #1

    Hi All,

    I was working on a Qt project where some .cpp and .h files were not included in the .pro file, resulting in cpp files not being compiled, and then linker errors as a result. That's as expected.

    To fix this, I right-clicked on the project in Qtcreator, and have choosen "Add existing files". Then i just selected all .cpp and .h files from the source directory. The list of files in Qtcreator then shows all the .cpp and .h files. On compile, I got a lot of "symbol redefined" errors. In the .pro file, a lot of .h and .cpp files are double listed in the .pro file. To fix this, i removed all the existing entries, and added all the .cpp and .h files again, and now the Qt program compiles and runs perfectly.

    It looks like QtCreator does not check if a file is already added to the project.
    Should I open a bug for this?

    My versions:
    Windows 7, Qt Creator 4.5.0 based on Qt 5.10.0 (MSVC 2015, 32 bit)

    Cheers,
    Cedric

    jsulmJ 1 Reply Last reply
    1
    • C cdwijs

      Hi All,

      I was working on a Qt project where some .cpp and .h files were not included in the .pro file, resulting in cpp files not being compiled, and then linker errors as a result. That's as expected.

      To fix this, I right-clicked on the project in Qtcreator, and have choosen "Add existing files". Then i just selected all .cpp and .h files from the source directory. The list of files in Qtcreator then shows all the .cpp and .h files. On compile, I got a lot of "symbol redefined" errors. In the .pro file, a lot of .h and .cpp files are double listed in the .pro file. To fix this, i removed all the existing entries, and added all the .cpp and .h files again, and now the Qt program compiles and runs perfectly.

      It looks like QtCreator does not check if a file is already added to the project.
      Should I open a bug for this?

      My versions:
      Windows 7, Qt Creator 4.5.0 based on Qt 5.10.0 (MSVC 2015, 32 bit)

      Cheers,
      Cedric

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @cdwijs Sure you can open a change request.

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      aha_1980A 1 Reply Last reply
      1
      • jsulmJ jsulm

        @cdwijs Sure you can open a change request.

        aha_1980A Offline
        aha_1980A Offline
        aha_1980
        Lifetime Qt Champion
        wrote on last edited by
        #3

        Just for reference: https://bugreports.qt.io/browse/QTCREATORBUG-19546

        Qt has to stay free or it will die.

        C 1 Reply Last reply
        1
        • aha_1980A aha_1980

          Just for reference: https://bugreports.qt.io/browse/QTCREATORBUG-19546

          C Offline
          C Offline
          cdwijs
          wrote on last edited by
          #4

          @aha_1980 Thanks for the heads up, I'm the one who created that bug :-)

          Cheers,
          Cedric

          1 Reply Last reply
          1

          • Login

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