Uploaded image for project: 'Qt Creator'
  1. Qt Creator
  2. QTCREATORBUG-20885

LNK4042 generated on Qt Creator due to .pro file having repeated filenames

    XMLWordPrintable

Details

    • Bug
    • Resolution: Duplicate
    • Not Evaluated
    • None
    • Qt Creator 4.6.2
    • Windows 10, ASUS A209J
    • Windows

    Description

      Unfortunately due to the nature of this bug I did not find an isolated case to provide, but I can describe steps to reproduce:

      I was working on the DockWindow example for QMainWIndow, and I decided I wanted to integrate DarkStyle from a repo, but manually had to copy and add files to the project.

      https://github.com/Jorgen-VikingGod/Qt-Frameless-Window-DarkStyle

      I added a few new files and folders from DarkStyle in something like this order:

      The files DarkStyle.cpp and DarkStyle.h

      The darkstyle/ folder (copied from inside an archive download)

      The images/ folder

      Then I copied framelesswindow/ folder and its contents to qt-mainapp/ but had not yet added it to the project or resources, however I did add darkstyle/ and images/ at this point.

      I "Add Existing Items..." and added the DarkStyle.cpp and Darkstyle.h files

      Then, I built and it threw LNK4042 on DarkStyle.h

      Caught off guard, I added some #pragma once and the issue went away, it built.

      Everything built and ran correctly, but the title bar was not changed because I only used the DarkStyle object.  I wanted to add the framelesswindow object.

      I then added framelesswindow/ after further consideration, but for a reason the framelesswindow.ui was not included (its a form)

       I then added the  images/ folder and the darkstyle/ folder to the .qrc from Add Existing Items.. context menu. 

      When I went to manually add

       FORMS += framelesswindow.ui 

      to the .pro file for the project, I noticed the HEADERS and SOURCES lists were really, really long, but I added the FORMS line and proceeded to build.

      I then built and it came back with something like 24 issues LNK4042

      After examining the .pro file, I saw that all of my original files (before adding DarkStyle files at all) in the HEADERS and SOURCES section were duplicated somewhat randomly twice.

       

      So if before it was:

      HEADERS = a.h\
      b.h\
      c.h\
      d.h
      

       

      it now read:

       

      HEADERS = a.h\
      b.h\
      c.h\
      b.h\
      c.h\
      d.h\
      b.h\
      c.h\
      d.h 
      

       

      This was repeated for SOURCES as well.

      Attachments

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              kandeler Christian Kandeler
              h3rb Herb Gilliland
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes