Qt Creator 4.x compile instructions
This page is a walkthrough for setting up MuseScore debugging with Qt Creator 4.x. It assumes you have completed all steps from Compile instructions (Windows - MinGW) - Git before starting.
- Once you setup everything above, you can open Qt Creator, either by typing
start qtcreatorfrom within a command prompt started as above, or by creating a separate batch file with
start qtcreatoras the last command.
- Go to File ⇒ Open File or Project....
- Choose CMakeLists.txt file type and open the file
CMakeLists.txtfrom your source directory. This will lead to a screen to start configuring the project.
Make sure to change the build directory to be
build.qtc directly under the directory of your git clone. Please make sure the name of the build directory does not contain spaces.
In the screenshot, the project was cloned into
MuseScore_git, so this results in the following setting:
Click on Configure Project to continue.
Navigate to Projects ⇒ Build & Run ⇒ Build to adjust the following CMake settings:
- OFF for 32-bit builds
..\win64installfor 64-bit builds, possible with Qt 5.12). Seems for master branch it is now one lever higher, so drop the
DEBUG(Prior to cd19c84 for master and cba1df2 for 2.2 mind the uppercasing!, later builds are fine using the default value of
Click on Apply Configuration Changes
CMake will automatically run. You'll see a spinner over the CMake settings while it does.
Note: You might get a warning from CMake about QT_QMAKE_EXECUTABLE not being used.
Build Settings: selecting targets
Scroll a bit down to the Build Steps area. Expand the Details of that area and select the
Use the button just below this list to add another Build step:
And set it to the
In the left column of the screen, click on Run to switch to the Run Settings. Where the Run configuration is set, choose to Add a
Finally, set the Executable value to
win64install for 64-bit builds and
MuseScore3.exe when building MuseScore 3, and
MuseScore4.exe when building MuseScore 4)
These are some of the problems that you may or may not face while completing the next section.
The compile time for debug build will vary from 10 minutes (8 core system) to 1 hour (single core) depending on the number of cores that your system has.
One should disable the ClangCodeModel in the top bar under Help > Plugins > C++ otherwise you may get many C++ errors/issues. These don't prevent a build but may result in missing important warnings and real errors.
After step 2, if you get an error stating that libgcc_s_seh-1.dll not found under your mingw root directory's bin, then you're most probably building a 32-bit version, then you have to disable BUILD_64 from your building process. To do so go to Projects in the left hand side. Under Build & Run, click on Build. Where you previously set CMAKE_EXECUTABLE_PATH, there will also be a checkbox for BUILD_64. Disable that and then follow the instructions in the next section.
Most likely you will be able to compile successfully.
To compile the debug build and start debugging you can do either one of the following:
- Go to Debug ⇒ Start debugging ⇒ Start debugging
- Click the debug icon. (green arrow with bug on top of it in the bottom left of Qt Creator)
- Press F5
If you have a multi-core/threading processor, compilation can be sped up significantly by allow Qt Creator to launch multiple parallel build processes. To achieve this, you can set
-j%NUMBER_OF_PROCESSORS% in the Tool arguments for both the Build Steps as the Deployment Steps.
On a quad-core hyperthreading processor you could go up to
-j8 to maximize the processor load. It might be wise to set the number to be one lower than your maximal number of processes, allowing you to perform another program while the build is running.
If you are facing errors which mention resfile.o in description like here (see https://musescore.org/en/node/151481), the following command line hack should help you.
The issue relates to incorrectly initialized windres tool and its path. To correctly initialize the related cmake data, please do the following:
- Close QtCreator
- Go to MuseScore repo
mingw32-make.exe -f Makefile.mingw debug
mingw32-make.exe -f Makefile.mingw installdebug
- Open Qt creator and debug MuseScore