Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. Cant build stanford CS106L projects using QTCreator
Forum Updated to NodeBB v4.3 + New Features

Cant build stanford CS106L projects using QTCreator

Scheduled Pinned Locked Moved Solved Qt Creator and other tools
18 Posts 6 Posters 1.3k Views
  • 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.
  • D Offline
    D Offline
    d14bl0
    wrote on last edited by
    #7

    @cristian-adam I tried to open the first 3 projects on https://learncs.me/stanford/cs106l which are:

    Assignment 1: GraphViz
    Assignment 2 (First Part): WikiRacer
    Assignment 2 (Second Part): WikiRacer

    I get the same errors for all of them

    1 Reply Last reply
    0
    • cristian-adamC Offline
      cristian-adamC Offline
      cristian-adam
      wrote on last edited by
      #8

      I've tried compiling the first assignment, and below is the output:

      09:05:35: Running steps for project GraphViz...
      09:05:35: Starting: "C:\Qt\6.7.2\mingw_64\bin\qmake.exe" C:\Projects\stanford\01_GraphViz\GraphViz.pro -spec win32-g++ "CONFIG+=debug" "CONFIG+=qml_debug"
      Info: creating stash file C:\Projects\stanford\01_GraphViz\build\Desktop_Qt_6_7_2_MinGW_64_bit-Debug\.qmake.stash
      WARNING: Failure to find: C:/Projects/stanford/01_GraphViz/src/*.h
      WARNING: Failure to find: C:/Projects/stanford/01_GraphViz/src/*.cpp
      WARNING: Failure to find: C:/Projects/stanford/01_GraphViz/src/*.h
      WARNING: Failure to find: C:/Projects/stanford/01_GraphViz/src/*.h
      WARNING: Failure to find: C:/Projects/stanford/01_GraphViz/src/*.cpp
      WARNING: Failure to find: C:/Projects/stanford/01_GraphViz/src/*.h
      09:05:35: The process "C:\Qt\6.7.2\mingw_64\bin\qmake.exe" exited normally.
      09:05:35: Starting: "C:\Qt\Tools\mingw1120_64\bin\mingw32-make.exe" -f C:/Projects/stanford/01_GraphViz/build/Desktop_Qt_6_7_2_MinGW_64_bit-Debug/Makefile qmake_all
      mingw32-make: Nothing to be done for 'qmake_all'.
      09:05:35: The process "C:\Qt\Tools\mingw1120_64\bin\mingw32-make.exe" exited normally.
      09:05:35: Starting: "C:\Qt\Tools\mingw1120_64\bin\mingw32-make.exe" -j8
      C:/Qt/Tools/mingw1120_64/bin/mingw32-make -f Makefile.Debug
      mingw32-make[1]: Entering directory 'C:/Projects/stanford/01_GraphViz/build/Desktop_Qt_6_7_2_MinGW_64_bit-Debug'
      Makefile.Debug:135: warning: overriding recipe for target 'debug/*.o'
      Makefile.Debug:132: warning: ignoring old recipe for target 'debug/*.o'
      gcc -c -fno-keep-inline-dllexport -g -Wall -Wextra -Wextra -DUNICODE -D_UNICODE -DWIN32 -DMINGW_HAS_SECURE_API=1 -DQT_QML_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -IC:/Qt/6.7.2/mingw_64/include -IC:/Qt/6.7.2/mingw_64/include/QtWidgets -IC:/Qt/6.7.2/mingw_64/include/QtGui -IC:/Qt/6.7.2/mingw_64/include/QtCore -Idebug -I/include -IC:/Qt/6.7.2/mingw_64/mkspecs/win32-g++  -o debug\*.o C:/Projects/stanford/01_GraphViz/src/*.h
      xcopy "C:\Projects\stanford\01_GraphViz\res" "C:\Projects\stanford\01_GraphViz\build\Desktop_Qt_6_7_2_MinGW_64_bit-Debug" /e /y
      C:\Projects\stanford\01_GraphViz\res\10clique
      C:\Projects\stanford\01_GraphViz\res\10grid
      C:\Projects\stanford\01_GraphViz\res\10line
      C:\Projects\stanford\01_GraphViz\res\127binary-tree
      C:\Projects\stanford\01_GraphViz\res\2line
      C:\Projects\stanford\01_GraphViz\res\30clique
      C:\Projects\stanford\01_GraphViz\res\30cycle
      C:\Projects\stanford\01_GraphViz\res\31binary-tree
      C:\Projects\stanford\01_GraphViz\res\32wheel
      C:\Projects\stanford\01_GraphViz\res\3grid
      C:\Projects\stanford\01_GraphViz\res\50line
      C:\Projects\stanford\01_GraphViz\res\5clique
      C:\Projects\stanford\01_GraphViz\res\5grid
      C:\Projects\stanford\01_GraphViz\res\60cycle
      C:\Projects\stanford\01_GraphViz\res\63binary-tree
      C:\Projects\stanford\01_GraphViz\res\64wheel
      C:\Projects\stanford\01_GraphViz\res\8wheel
      C:\Projects\stanford\01_GraphViz\res\bull
      C:\Projects\stanford\01_GraphViz\res\cube
      C:\Projects\stanford\01_GraphViz\res\desargues
      C:\Projects\stanford\01_GraphViz\res\dodecahedron
      C:\Projects\stanford\01_GraphViz\res\doodad-1
      C:\Projects\stanford\01_GraphViz\res\doodad-2
      C:\Projects\stanford\01_GraphViz\res\doodad-3
      C:\Projects\stanford\01_GraphViz\res\durer
      C:\Projects\stanford\01_GraphViz\res\heawood
      C:\Projects\stanford\01_GraphViz\res\icosahedron
      C:\Projects\stanford\01_GraphViz\res\mobius-kantor
      C:\Projects\stanford\01_GraphViz\res\moser-spindle
      C:\Projects\stanford\01_GraphViz\res\octahedron
      C:\Projects\stanford\01_GraphViz\res\petersen
      C:\Projects\stanford\01_GraphViz\res\star
      C:\Projects\stanford\01_GraphViz\res\tesseract
      C:\Projects\stanford\01_GraphViz\res\tietze
      C:\Projects\stanford\01_GraphViz\res\triangle
      35 File(s) copied
      C:/Projects/stanford/01_GraphViz/src/SimpleGraph.h:1: fatal error: cannot create precompiled header debug*.o: Invalid argument
          1 | #pragma once
            |
      compilation terminated.
      mingw32-make[1]: *** [Makefile.Debug:135: debug/*.o] Error 1
      mingw32-make: *** [Makefile:45: debug] Error 2
      mingw32-make[1]: Leaving directory 'C:/Projects/stanford/01_GraphViz/build/Desktop_Qt_6_7_2_MinGW_64_bit-Debug'
      09:05:35: The process "C:\Qt\Tools\mingw1120_64\bin\mingw32-make.exe" exited with code 2.
      Error while building/deploying project GraphViz (kit: Desktop Qt 6.7.2 MinGW 64-bit)
      When executing step "Make"
      09:05:35: Elapsed time: 00:01.
      

      It still didn't work, but didn't give thousands of errors.

      I would suggest to delete your build directory, and try again. You should at least get the errors I'm getting 😅

      1 Reply Last reply
      0
      • cristian-adamC Offline
        cristian-adamC Offline
        cristian-adam
        wrote on last edited by
        #9

        Change in your GraphViz.pro the following lines:

        SOURCES += $$PWD/src/*.cpp
        SOURCES += $$PWD/src/*.h
        HEADERS += $$PWD/src/*.h
        
        # set up flags for the compiler and Stanford C++ libraries
        QMAKE_CXXFLAGS += -std=c++11 \
        

        to these lines:

        SOURCES += $$files(src/*.cpp)
        SOURCES += $$files(src/*.h)
        HEADERS += $$files(src/*.h)
        
        # set up flags for the compiler and Stanford C++ libraries
        QMAKE_CXXFLAGS += -std=c++17 \
        

        And your project will compile with MinGW 11.2.0.

        The first part fixed my issue, the second part will fix your issue 😀

        1 Reply Last reply
        2
        • D Offline
          D Offline
          d14bl0
          wrote on last edited by
          #10

          Hey many thanks for taking the time.

          Your solution got rid of all errors except 1 (copyResources Error 4), I have tried a few things recommended by chatGPT but still no luck :/

          image.png

          aha_1980A 1 Reply Last reply
          0
          • cristian-adamC Offline
            cristian-adamC Offline
            cristian-adam
            wrote on last edited by
            #11

            I deleted the build directory and then right click on the project and then selected Build and the output looks like this:

            19:16:06: Running steps for project GraphViz...
            19:16:06: Starting: "C:\Qt\6.7.2\mingw_64\bin\qmake.exe" C:\Projects\stanford\01_GraphViz\GraphViz.pro -spec win32-g++ "CONFIG+=debug" "CONFIG+=qml_debug"
            Info: creating stash file C:\Projects\stanford\01_GraphViz\build\Desktop_Qt_6_7_2_MinGW_64_bit-Debug\.qmake.stash
            19:16:09: The process "C:\Qt\6.7.2\mingw_64\bin\qmake.exe" exited normally.
            19:16:09: Starting: "C:\Qt\Tools\mingw1120_64\bin\mingw32-make.exe" -f C:/Projects/stanford/01_GraphViz/build/Desktop_Qt_6_7_2_MinGW_64_bit-Debug/Makefile qmake_all
            mingw32-make: Nothing to be done for 'qmake_all'.
            19:16:09: The process "C:\Qt\Tools\mingw1120_64\bin\mingw32-make.exe" exited normally.
            19:16:09: Starting: "C:\Qt\Tools\mingw1120_64\bin\mingw32-make.exe" -j8
            C:/Qt/Tools/mingw1120_64/bin/mingw32-make -f Makefile.Debug
            mingw32-make[1]: Entering directory 'C:/Projects/stanford/01_GraphViz/build/Desktop_Qt_6_7_2_MinGW_64_bit-Debug'
            g++ -c -fno-keep-inline-dllexport -std=c++17 -Wall -Wextra -Wreturn-type -Werror=return-type -Wunreachable-code -g -Wall -Wextra -Wextra -fexceptions -mthreads -DUNICODE -D_UNICODE -DWIN32 -DMINGW_HAS_SECURE_API=1 -DQT_QML_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -IC:/Qt/6.7.2/mingw_64/include -IC:/Qt/6.7.2/mingw_64/include/QtWidgets -IC:/Qt/6.7.2/mingw_64/include/QtGui -IC:/Qt/6.7.2/mingw_64/include/QtCore -Idebug -I/include -IC:/Qt/6.7.2/mingw_64/mkspecs/win32-g++  -o debug\main.o ..\..\src\main.cpp
            g++ -c -fno-keep-inline-dllexport -std=c++17 -Wall -Wextra -Wreturn-type -Werror=return-type -Wunreachable-code -g -Wall -Wextra -Wextra -fexceptions -mthreads -DUNICODE -D_UNICODE -DWIN32 -DMINGW_HAS_SECURE_API=1 -DQT_QML_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -IC:/Qt/6.7.2/mingw_64/include -IC:/Qt/6.7.2/mingw_64/include/QtWidgets -IC:/Qt/6.7.2/mingw_64/include/QtGui -IC:/Qt/6.7.2/mingw_64/include/QtCore -Idebug -I/include -IC:/Qt/6.7.2/mingw_64/mkspecs/win32-g++  -o debug\SimpleGraph.o ..\..\src\SimpleGraph.cpp
            g++ -fno-keep-inline-dllexport -std=c++17 -Wall -Wextra -Wreturn-type -Werror=return-type -Wunreachable-code -g -Wall -Wextra -Wextra -dM -E -o debug\moc_predefs.h C:\Qt\6.7.2\mingw_64\mkspecs\features\data\dummy.cpp
            xcopy "C:\Projects\stanford\01_GraphViz\res" "C:\Projects\stanford\01_GraphViz\build\Desktop_Qt_6_7_2_MinGW_64_bit-Debug" /e /y 
            C:\Projects\stanford\01_GraphViz\res\10clique
            C:\Projects\stanford\01_GraphViz\res\10grid
            C:\Projects\stanford\01_GraphViz\res\10line
            C:\Projects\stanford\01_GraphViz\res\127binary-tree
            C:\Projects\stanford\01_GraphViz\res\2line
            C:\Projects\stanford\01_GraphViz\res\30clique
            C:\Projects\stanford\01_GraphViz\res\30cycle
            C:\Projects\stanford\01_GraphViz\res\31binary-tree
            C:\Projects\stanford\01_GraphViz\res\32wheel
            C:\Projects\stanford\01_GraphViz\res\3grid
            C:\Projects\stanford\01_GraphViz\res\50line
            C:\Projects\stanford\01_GraphViz\res\5clique
            C:\Projects\stanford\01_GraphViz\res\5grid
            C:\Projects\stanford\01_GraphViz\res\60cycle
            C:\Projects\stanford\01_GraphViz\res\63binary-tree
            C:\Projects\stanford\01_GraphViz\res\64wheel
            C:\Projects\stanford\01_GraphViz\res\8wheel
            C:\Projects\stanford\01_GraphViz\res\bull
            C:\Projects\stanford\01_GraphViz\res\cube
            C:\Projects\stanford\01_GraphViz\res\desargues
            C:\Projects\stanford\01_GraphViz\res\dodecahedron
            C:\Projects\stanford\01_GraphViz\res\doodad-1
            C:\Projects\stanford\01_GraphViz\res\doodad-2
            C:\Projects\stanford\01_GraphViz\res\doodad-3
            C:\Projects\stanford\01_GraphViz\res\durer
            C:\Projects\stanford\01_GraphViz\res\heawood
            C:\Projects\stanford\01_GraphViz\res\icosahedron
            C:\Projects\stanford\01_GraphViz\res\mobius-kantor
            C:\Projects\stanford\01_GraphViz\res\moser-spindle
            C:\Projects\stanford\01_GraphViz\res\octahedron
            C:\Projects\stanford\01_GraphViz\res\petersen
            C:\Projects\stanford\01_GraphViz\res\star
            C:\Projects\stanford\01_GraphViz\res\tesseract
            C:\Projects\stanford\01_GraphViz\res\tietze
            C:\Projects\stanford\01_GraphViz\res\triangle
            35 File(s) copied
            C:\Qt\6.7.2\mingw_64\bin\moc.exe -DUNICODE -D_UNICODE -DWIN32 -DMINGW_HAS_SECURE_API=1 -DQT_QML_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB --include C:/Projects/stanford/01_GraphViz/build/Desktop_Qt_6_7_2_MinGW_64_bit-Debug/debug/moc_predefs.h -IC:/Qt/6.7.2/mingw_64/mkspecs/win32-g++ -IC:/Projects/stanford/01_GraphViz -IC:/Qt/6.7.2/mingw_64/include -IC:/Qt/6.7.2/mingw_64/include/QtWidgets -IC:/Qt/6.7.2/mingw_64/include/QtGui -IC:/Qt/6.7.2/mingw_64/include/QtCore -IC:/Qt/Tools/mingw1120_64/lib/gcc/x86_64-w64-mingw32/11.2.0/include/c++ -IC:/Qt/Tools/mingw1120_64/lib/gcc/x86_64-w64-mingw32/11.2.0/include/c++/x86_64-w64-mingw32 -IC:/Qt/Tools/mingw1120_64/lib/gcc/x86_64-w64-mingw32/11.2.0/include/c++/backward -IC:/Qt/Tools/mingw1120_64/lib/gcc/x86_64-w64-mingw32/11.2.0/include -IC:/Qt/Tools/mingw1120_64/lib/gcc/x86_64-w64-mingw32/11.2.0/include-fixed -IC:/Qt/Tools/mingw1120_64/x86_64-w64-mingw32/include ..\..\src\SimpleGraph.h -o debug\moc_SimpleGraph.cpp
            g++ -c -fno-keep-inline-dllexport -std=c++17 -Wall -Wextra -Wreturn-type -Werror=return-type -Wunreachable-code -g -Wall -Wextra -Wextra -fexceptions -mthreads -DUNICODE -D_UNICODE -DWIN32 -DMINGW_HAS_SECURE_API=1 -DQT_QML_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -IC:/Qt/6.7.2/mingw_64/include -IC:/Qt/6.7.2/mingw_64/include/QtWidgets -IC:/Qt/6.7.2/mingw_64/include/QtGui -IC:/Qt/6.7.2/mingw_64/include/QtCore -Idebug -I/include -IC:/Qt/6.7.2/mingw_64/mkspecs/win32-g++  -o debug\moc_SimpleGraph.o debug\moc_SimpleGraph.cpp
            ..\..\src\SimpleGraph.cpp: In member function 'virtual void WorkerThread::run()':
            ..\..\src\SimpleGraph.cpp:95:22: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
               95 |         int _userMain();
                  |                      ^~
            ..\..\src\SimpleGraph.cpp:95:22: note: remove parentheses to default-initialize a variable
               95 |         int _userMain();
                  |                      ^~
                  |                      --
            ..\..\src\SimpleGraph.cpp:95:22: note: or replace parentheses with braces to value-initialize a variable
            g++ -Wl,-subsystem,console -mthreads -o debug\GraphViz.exe debug/main.o debug/SimpleGraph.o debug/moc_SimpleGraph.o C:\Qt\6.7.2\mingw_64\lib\libQt6Widgets.a C:\Qt\6.7.2\mingw_64\lib\libQt6Gui.a C:\Qt\6.7.2\mingw_64\lib\libQt6Core.a   
            mingw32-make[1]: Leaving directory 'C:/Projects/stanford/01_GraphViz/build/Desktop_Qt_6_7_2_MinGW_64_bit-Debug'
            19:16:21: The process "C:\Qt\Tools\mingw1120_64\bin\mingw32-make.exe" exited normally.
            19:16:21: Elapsed time: 00:15.
            

            I don't see a reason why this should fail. You can check:

            • that the build path doesn't contain spaces or something weird
            • disable the antivirus, which for some reason would want to block something
            1 Reply Last reply
            1
            • D d14bl0

              Hey many thanks for taking the time.

              Your solution got rid of all errors except 1 (copyResources Error 4), I have tried a few things recommended by chatGPT but still no luck :/

              image.png

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

              @d14bl0 In addition to what @cristian-adam said: Please show the compile output (best as text) so we see what actually goes wrong.

              Regards

              Qt has to stay free or it will die.

              1 Reply Last reply
              0
              • D Offline
                D Offline
                d14bl0
                wrote on last edited by d14bl0
                #13

                This is the compile output after disabling antivirus:

                11:12:33: Running steps for project GraphViz...
                11:12:33: Configuration unchanged, skipping qmake step.
                11:12:33: Starting: "C:\Qt\Tools\mingw1120_64\bin\mingw32-make.exe" -j20
                C:/Qt/Tools/mingw1120_64/bin/mingw32-make -f Makefile.Debug
                mingw32-make[1]: Entering directory 'C:/Users/DELLPHOTO/Downloads/01_GraphViz_2/01_GraphViz/build/Desktop_Qt_6_7_2_MinGW_64_bit-Debug'
                xcopy "C:\Users\DELLPHOTO\Downloads\01_GraphViz_2\01_GraphViz\res" "C:\Users\DELLPHOTO\Downloads\01_GraphViz_2\01_GraphViz\build\Desktop_Qt_6_7_2_MinGW_64_bit-Debug" /e /y 
                Invalid number of parameters
                mingw32-make[1]: *** [Makefile.Debug:91: copyResources] Error 4
                mingw32-make[1]: Leaving directory 'C:/Users/DELLPHOTO/Downloads/01_GraphViz_2/01_GraphViz/build/Desktop_Qt_6_7_2_MinGW_64_bit-Debug'
                mingw32-make: *** [Makefile:45: debug] Error 2
                11:12:33: The process "C:\Qt\Tools\mingw1120_64\bin\mingw32-make.exe" exited with code 2.
                Error while building/deploying project GraphViz (kit: Desktop Qt 6.7.2 MinGW 64-bit)
                When executing step "Make"
                11:12:33: Elapsed time: 00:00.
                

                and this is the .pro file

                QT += widgets
                
                CONFIG += no_include_pwd
                CONFIG += console
                CONFIG -= app_bundle
                
                SOURCES += $$files(src/*.cpp)
                SOURCES += $$files(src/*.h)
                HEADERS += $$files(src/*.h)
                
                QMAKE_CXXFLAGS += -std=c++17 \
                    -Wall \
                    -Wextra \
                    -Wreturn-type \
                    -Werror=return-type \
                    -Wunreachable-code \
                
                defineTest(copyToDestdir) {
                    files = $$1
                
                    for(FILE, files) {
                        DDIR = $$OUT_PWD
                
                        win32:FILE ~= s,/,\\,g
                        win32:DDIR ~= s,/,\\,g
                
                        !win32 {
                            copyResources.commands += cp -r '"'$$FILE'"' '"'$$DDIR'"' $$escape_expand(\\n\\t)
                        }
                        win32 {
                            copyResources.commands += xcopy '"'$$FILE'"' '"'$$DDIR'"' /e /y $$escape_expand(\\n\\t)
                        }
                    }
                    export(copyResources.commands)
                }
                
                !win32 {
                    copyToDestdir($$files($$PWD/res/*))
                }
                win32 {
                    copyToDestdir($$PWD/res)
                }
                
                copyResources.input = $$files($$PWD/res)
                OTHER_FILES = $$files(res/*)
                QMAKE_EXTRA_TARGETS += copyResources
                POST_TARGETDEPS += copyResources
                
                macx {
                    cache()
                    QMAKE_MAC_SDK = macosx
                }
                
                jsulmJ J.HilkJ cristian-adamC 3 Replies Last reply
                0
                • D d14bl0

                  This is the compile output after disabling antivirus:

                  11:12:33: Running steps for project GraphViz...
                  11:12:33: Configuration unchanged, skipping qmake step.
                  11:12:33: Starting: "C:\Qt\Tools\mingw1120_64\bin\mingw32-make.exe" -j20
                  C:/Qt/Tools/mingw1120_64/bin/mingw32-make -f Makefile.Debug
                  mingw32-make[1]: Entering directory 'C:/Users/DELLPHOTO/Downloads/01_GraphViz_2/01_GraphViz/build/Desktop_Qt_6_7_2_MinGW_64_bit-Debug'
                  xcopy "C:\Users\DELLPHOTO\Downloads\01_GraphViz_2\01_GraphViz\res" "C:\Users\DELLPHOTO\Downloads\01_GraphViz_2\01_GraphViz\build\Desktop_Qt_6_7_2_MinGW_64_bit-Debug" /e /y 
                  Invalid number of parameters
                  mingw32-make[1]: *** [Makefile.Debug:91: copyResources] Error 4
                  mingw32-make[1]: Leaving directory 'C:/Users/DELLPHOTO/Downloads/01_GraphViz_2/01_GraphViz/build/Desktop_Qt_6_7_2_MinGW_64_bit-Debug'
                  mingw32-make: *** [Makefile:45: debug] Error 2
                  11:12:33: The process "C:\Qt\Tools\mingw1120_64\bin\mingw32-make.exe" exited with code 2.
                  Error while building/deploying project GraphViz (kit: Desktop Qt 6.7.2 MinGW 64-bit)
                  When executing step "Make"
                  11:12:33: Elapsed time: 00:00.
                  

                  and this is the .pro file

                  QT += widgets
                  
                  CONFIG += no_include_pwd
                  CONFIG += console
                  CONFIG -= app_bundle
                  
                  SOURCES += $$files(src/*.cpp)
                  SOURCES += $$files(src/*.h)
                  HEADERS += $$files(src/*.h)
                  
                  QMAKE_CXXFLAGS += -std=c++17 \
                      -Wall \
                      -Wextra \
                      -Wreturn-type \
                      -Werror=return-type \
                      -Wunreachable-code \
                  
                  defineTest(copyToDestdir) {
                      files = $$1
                  
                      for(FILE, files) {
                          DDIR = $$OUT_PWD
                  
                          win32:FILE ~= s,/,\\,g
                          win32:DDIR ~= s,/,\\,g
                  
                          !win32 {
                              copyResources.commands += cp -r '"'$$FILE'"' '"'$$DDIR'"' $$escape_expand(\\n\\t)
                          }
                          win32 {
                              copyResources.commands += xcopy '"'$$FILE'"' '"'$$DDIR'"' /e /y $$escape_expand(\\n\\t)
                          }
                      }
                      export(copyResources.commands)
                  }
                  
                  !win32 {
                      copyToDestdir($$files($$PWD/res/*))
                  }
                  win32 {
                      copyToDestdir($$PWD/res)
                  }
                  
                  copyResources.input = $$files($$PWD/res)
                  OTHER_FILES = $$files(res/*)
                  QMAKE_EXTRA_TARGETS += copyResources
                  POST_TARGETDEPS += copyResources
                  
                  macx {
                      cache()
                      QMAKE_MAC_SDK = macosx
                  }
                  
                  jsulmJ Offline
                  jsulmJ Offline
                  jsulm
                  Lifetime Qt Champion
                  wrote on last edited by
                  #14

                  @d14bl0 Looks like the xcopy command usage is wrong, check that

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

                  1 Reply Last reply
                  0
                  • D d14bl0

                    This is the compile output after disabling antivirus:

                    11:12:33: Running steps for project GraphViz...
                    11:12:33: Configuration unchanged, skipping qmake step.
                    11:12:33: Starting: "C:\Qt\Tools\mingw1120_64\bin\mingw32-make.exe" -j20
                    C:/Qt/Tools/mingw1120_64/bin/mingw32-make -f Makefile.Debug
                    mingw32-make[1]: Entering directory 'C:/Users/DELLPHOTO/Downloads/01_GraphViz_2/01_GraphViz/build/Desktop_Qt_6_7_2_MinGW_64_bit-Debug'
                    xcopy "C:\Users\DELLPHOTO\Downloads\01_GraphViz_2\01_GraphViz\res" "C:\Users\DELLPHOTO\Downloads\01_GraphViz_2\01_GraphViz\build\Desktop_Qt_6_7_2_MinGW_64_bit-Debug" /e /y 
                    Invalid number of parameters
                    mingw32-make[1]: *** [Makefile.Debug:91: copyResources] Error 4
                    mingw32-make[1]: Leaving directory 'C:/Users/DELLPHOTO/Downloads/01_GraphViz_2/01_GraphViz/build/Desktop_Qt_6_7_2_MinGW_64_bit-Debug'
                    mingw32-make: *** [Makefile:45: debug] Error 2
                    11:12:33: The process "C:\Qt\Tools\mingw1120_64\bin\mingw32-make.exe" exited with code 2.
                    Error while building/deploying project GraphViz (kit: Desktop Qt 6.7.2 MinGW 64-bit)
                    When executing step "Make"
                    11:12:33: Elapsed time: 00:00.
                    

                    and this is the .pro file

                    QT += widgets
                    
                    CONFIG += no_include_pwd
                    CONFIG += console
                    CONFIG -= app_bundle
                    
                    SOURCES += $$files(src/*.cpp)
                    SOURCES += $$files(src/*.h)
                    HEADERS += $$files(src/*.h)
                    
                    QMAKE_CXXFLAGS += -std=c++17 \
                        -Wall \
                        -Wextra \
                        -Wreturn-type \
                        -Werror=return-type \
                        -Wunreachable-code \
                    
                    defineTest(copyToDestdir) {
                        files = $$1
                    
                        for(FILE, files) {
                            DDIR = $$OUT_PWD
                    
                            win32:FILE ~= s,/,\\,g
                            win32:DDIR ~= s,/,\\,g
                    
                            !win32 {
                                copyResources.commands += cp -r '"'$$FILE'"' '"'$$DDIR'"' $$escape_expand(\\n\\t)
                            }
                            win32 {
                                copyResources.commands += xcopy '"'$$FILE'"' '"'$$DDIR'"' /e /y $$escape_expand(\\n\\t)
                            }
                        }
                        export(copyResources.commands)
                    }
                    
                    !win32 {
                        copyToDestdir($$files($$PWD/res/*))
                    }
                    win32 {
                        copyToDestdir($$PWD/res)
                    }
                    
                    copyResources.input = $$files($$PWD/res)
                    OTHER_FILES = $$files(res/*)
                    QMAKE_EXTRA_TARGETS += copyResources
                    POST_TARGETDEPS += copyResources
                    
                    macx {
                        cache()
                        QMAKE_MAC_SDK = macosx
                    }
                    
                    J.HilkJ Offline
                    J.HilkJ Offline
                    J.Hilk
                    Moderators
                    wrote on last edited by
                    #15

                    @d14bl0 said in Cant build stanford CS106L projects using QTCreator:

                    SOURCES += $$files(src/*.cpp)
                    SOURCES += $$files(src/*.h)
                    HEADERS += $$files(src/*.h)
                    

                    is this correct ? From personal experience I would say no, adding header files to sources usually leads to compile problems!?


                    Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


                    Q: What's that?
                    A: It's blue light.
                    Q: What does it do?
                    A: It turns blue.

                    1 Reply Last reply
                    2
                    • D d14bl0

                      This is the compile output after disabling antivirus:

                      11:12:33: Running steps for project GraphViz...
                      11:12:33: Configuration unchanged, skipping qmake step.
                      11:12:33: Starting: "C:\Qt\Tools\mingw1120_64\bin\mingw32-make.exe" -j20
                      C:/Qt/Tools/mingw1120_64/bin/mingw32-make -f Makefile.Debug
                      mingw32-make[1]: Entering directory 'C:/Users/DELLPHOTO/Downloads/01_GraphViz_2/01_GraphViz/build/Desktop_Qt_6_7_2_MinGW_64_bit-Debug'
                      xcopy "C:\Users\DELLPHOTO\Downloads\01_GraphViz_2\01_GraphViz\res" "C:\Users\DELLPHOTO\Downloads\01_GraphViz_2\01_GraphViz\build\Desktop_Qt_6_7_2_MinGW_64_bit-Debug" /e /y 
                      Invalid number of parameters
                      mingw32-make[1]: *** [Makefile.Debug:91: copyResources] Error 4
                      mingw32-make[1]: Leaving directory 'C:/Users/DELLPHOTO/Downloads/01_GraphViz_2/01_GraphViz/build/Desktop_Qt_6_7_2_MinGW_64_bit-Debug'
                      mingw32-make: *** [Makefile:45: debug] Error 2
                      11:12:33: The process "C:\Qt\Tools\mingw1120_64\bin\mingw32-make.exe" exited with code 2.
                      Error while building/deploying project GraphViz (kit: Desktop Qt 6.7.2 MinGW 64-bit)
                      When executing step "Make"
                      11:12:33: Elapsed time: 00:00.
                      

                      and this is the .pro file

                      QT += widgets
                      
                      CONFIG += no_include_pwd
                      CONFIG += console
                      CONFIG -= app_bundle
                      
                      SOURCES += $$files(src/*.cpp)
                      SOURCES += $$files(src/*.h)
                      HEADERS += $$files(src/*.h)
                      
                      QMAKE_CXXFLAGS += -std=c++17 \
                          -Wall \
                          -Wextra \
                          -Wreturn-type \
                          -Werror=return-type \
                          -Wunreachable-code \
                      
                      defineTest(copyToDestdir) {
                          files = $$1
                      
                          for(FILE, files) {
                              DDIR = $$OUT_PWD
                      
                              win32:FILE ~= s,/,\\,g
                              win32:DDIR ~= s,/,\\,g
                      
                              !win32 {
                                  copyResources.commands += cp -r '"'$$FILE'"' '"'$$DDIR'"' $$escape_expand(\\n\\t)
                              }
                              win32 {
                                  copyResources.commands += xcopy '"'$$FILE'"' '"'$$DDIR'"' /e /y $$escape_expand(\\n\\t)
                              }
                          }
                          export(copyResources.commands)
                      }
                      
                      !win32 {
                          copyToDestdir($$files($$PWD/res/*))
                      }
                      win32 {
                          copyToDestdir($$PWD/res)
                      }
                      
                      copyResources.input = $$files($$PWD/res)
                      OTHER_FILES = $$files(res/*)
                      QMAKE_EXTRA_TARGETS += copyResources
                      POST_TARGETDEPS += copyResources
                      
                      macx {
                          cache()
                          QMAKE_MAC_SDK = macosx
                      }
                      
                      cristian-adamC Offline
                      cristian-adamC Offline
                      cristian-adam
                      wrote on last edited by
                      #16

                      @d14bl0 You could just comment the whole copyResources part and do the copy of the res directory manually.

                      This way QMake won't try to do smart things that fail in weird ways.

                      1 Reply Last reply
                      0
                      • D Offline
                        D Offline
                        d14bl0
                        wrote on last edited by
                        #17

                        @cristian-adam Hey thank you very much! that worked :D I was just about to give up.

                        Thanks again!!!

                        cristian-adamC 1 Reply Last reply
                        1
                        • D d14bl0

                          @cristian-adam Hey thank you very much! that worked :D I was just about to give up.

                          Thanks again!!!

                          cristian-adamC Offline
                          cristian-adamC Offline
                          cristian-adam
                          wrote on last edited by
                          #18

                          @d14bl0 said in Cant build stanford CS106L projects using QTCreator:

                          @cristian-adam Hey thank you very much! that worked :D I was just about to give up.

                          Thanks again!!!

                          Don't forget to mark the thread as Solved.

                          1 Reply Last reply
                          0
                          • D d14bl0 has marked this topic as solved on

                          • Login

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