Uploaded image for project: 'Qt Visual Studio Tools'
  1. Qt Visual Studio Tools
  2. QTVSADDINBUG-522

Preprocessor define are declare twice

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P2: Important
    • 2.2.1
    • 2.2.0
    • General
    • None
    • f69211db53eee06ec3c6ed8d38a134e77499445d

    Description

      With the new addons, when a header file is added, all current define are added to field "Macro Definition" of the custom moc rules.

      It's quite the same behavior as previously when the define was added to the moc command line.

      But now, this define are also used for the compilation of the moc files!

      This could generates errors when the define are change in the project (the moc files won't used the new define declare in the project) or generate few warning, if using a precompile header.

       

      I think that the field "Macro definition" should be used only for the moc command line, and not for the 'moc_XXX.cpp" compilation. This last file should be compile with the C++ options define inside the vcxproj (like it was before this addins updates).

       

      Here an example that can happen. Reproduce step: 

      In a vcsproj/props, C++ define field, declare a define like this "MyDefineValue=1000". Enable Precomile header.

      Then add a header file with a Qt class inside this project.

      When compile the project, and see an error like that when compiling in C++ the "moc_XXX.cpp" file:

      "warning C4005: 'MyDefineValue': macro redefinition"

       

      Attachments

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

        Activity

          People

            mecfc Miguel Costa
            francoisj Francois JEAN
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes