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



  • 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


  • Moderators

    @cdwijs Sure you can open a change request.


  • Qt Champions 2017



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

    Cheers,
    Cedric


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.