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

"Create Basic .pro File" create the wrong structure in .pro (or incompatible??)

    XMLWordPrintable

Details

    • Bug
    • Resolution: Won't Do
    • Not Evaluated
    • 3.0.1
    • 2.6.0 (rev.07)
    • None
    • Windows 10
      Visual Studio 2019
    • Windows

    Description

      The Project Structure I designed in VS:

      bin             // Output Files and Third-Party DLL 
           win32
           win64
      include         // Third-Party Headers
      lib             // Third-Party Library
           win32
           win64
      src             // Source Files
           QtSolution          // Solution Folder
               QtProject1      // Project Folder
                  build        // Intermediate Folder

      First, I created a QtWidgetApplication in Visual Studio.
      Then, I made some changes in Project Properties. 
      (1) Output Directory: $(SolutionDir)..\..\bin\win32
      (2) Intermediate Directory: $(ProjectDir)build\$(Configuration)
      (3) Working Directory: $(SolutionDir)..\..\bin\win32
      (4) Additional Include Directories: $(Solution)..\..\include
      (5) Additional Library Directories: $(Solution)..\..\lib\win32

      Something wrong with "Create Basic .pro File"

      After setting up the Project Properties, I build the project and run the ouput executable. It works successfully. And then I pressed "Create Basic .pro File" so that I could open and edit in QtCreator (if I want to). However, in the .pro file that VS created, I found that

      DESTDIR = ../../bin/win32
      LIBS += -L"$(SolutionDir)../../lib/win32"
      DEPENDPATH += .
      MOC_DIR += .
      UI_DIR += .
      RCC_DIR += .

      Moreover, After opening .pro file with QtCreator, I tried to build the project, but an error showed up:

      error: C1083: 無法開啟包含檔案: 'ui_qtwidgetsapplication1.h': No such file or directory
      

      Indeed, After I checked the Intermediate Folder created by QtCreator, I didn't find 'ui_qtwidgetsapplication1.h'.

      It looks like that
      the directory of Generated Files created by Visual Studio are: (Inside the Project Folder)

      $(ProjectDir)build/Debug/moc/
      $(ProjectDir)build/Debug/rcc/
      $(ProjectDir)build/Debug/qrc/

      And the directory of Generated Files created by QtCreator are: (Outside the Project Folder)

      $(ProjectDir)../build-QtWidgetsApplication1-Desktop_Qt_5_15_0_VS2019_32bit-Debug/debug/

      Questions I sorted out to ask

      It looks like that Visual Studio has some bugs when "Creating Basic .pro File".

      (1) Why doesn't DEPENDPATH have "$(SolutionDir)../../include"??

      (2) Why doesn't DESTDIR have "$(SolutionDir)"?? 

      (3) Does $(SolutionDir) work in QtCreator? (I guess not) Then, Does that mean that I had better not use VS-default variables in Project Properties?? 

      (4) Why MOC_DIR, UI_DIR, RCC_DIR are "."??

      (5) Why didn't QtCreator create 'ui_qtwidgetsapplication1.h'?

       

      Attachments

        1. 01_Build_and_Run_in_VS_success.png
          142 kB
          Haowei Hsu
        2. 02_Create_Basic_pro_File.png
          59 kB
          Haowei Hsu
        3. 03_Build_and_Run_in_QtCreator_error.png
          136 kB
          Haowei Hsu
        4. 04_IntermediateFolder_VS_QtCreator.png
          107 kB
          Haowei Hsu
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            mecfc Miguel Costa
            hwhsu1231 Haowei Hsu
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes