Let's start with the background leading up to this article... I had a question where I needed to build a Qt sample, specifically this one: <install>\maxsdk\howto\qtObjectDemo. I wanted to continue setting up my newer laptop and had not installed Qt yet, and was just getting 3ds Max 2022 setup. I am using Visual Studio 2019, but of course targeting the MSVC 2017 toolset (141).
First, the output window in Visual Studio does not always tell you the details of what went wrong with a build action. I learned recently the amount of detail can be configured through the “Build and Run” settings. By default it seems the setting is “Minimal”. You can find the setting in “Options”, which can be found in at least two places: the Debug menu and also Tools menu. For example, navigate to the “Tools”->”Options” and then select “Projects and Solutions” in the left list of categories. Under that category, select “Build and Run” and then you will see two drop downs titled “MSBuild project build output verbosity” and “MSBuild project build log verbosity”. In my setup, these are set to Minimal at start.
Why would you need to change this? Anytime the output window shows you an error, but does not give enough information! In my case, again, I was trying to compile the <install>\maxsdk\howto\qtObjectDemo sample. To build an individual sample, I usually just open the vcxproj into a text editor and change the <MaxSDK> entry to the Windows environment variable that is created when installing the SDK. For example in 2022, my entry looks like this: ADSK_3DSMAX_SDK_2022=D:\me\3dsmax\maxsdk2022\maxsdk, so dropping $(ADSK_3DSMAX_SDK_2022) into that MaxSDK definition is enough for the Max SDK components to be found (include, libraries, tools).
The issue came -up with a failed build and when the “minimal” output said: “The system cannot find the path specified.” Very helpful… Not. Ok, I’ll get to the troubleshooting help after we talk about Qt.
The next topic to include here is the Qt tools. Let’s start by reminding you about Qt. 3ds Max started to include Qt in the 3ds Max 2017 release. Each release requires a different version of Qt to correspond to the 3ds Max version used for each major release. You will find the specifics in the SDK Requirements docs. For 2022 see here. The good news is that only the 3ds Max 2017 release required a “patched” version of Qt (available in pre-built form on the 3ds Max developer center. All versions after that are using the default source and binaries from Qt directly.
Next comes installing Qt… Qt distributions are a bit interesting. They now have a commercial version, and an open source version. As a developer, you will need to decide which version is appropriate for your business. Either version will install Visual Studio specific versions. So, if you are supporting multiple 3ds Max versions, you will also need to install multiple versions of Qt, and their Qt Maintenance Tool can help you to stay updated as you move forward. For example, I installed these for my new machine:
Again, for me, I needed to setup a new machine, and also at same time was setting up for the recent 3ds Max 2022 release, I was able to select the versions listed from the 3ds Max SDK Requirements… After the Qt installation (which took some time), it also helps to have the Visual Studio Qt Extension. From the SDK docs, see step 2 here.
In my case, I was setting up Visual Studio 2019 Professional IDE (to use with the msvc2017 toolset (141)). The place to install the Qt Extension is on a menu called “Extensions”. Here you can click “Manage” and search for Qt and then install it.
Next, using the Qt Extension, you can configure Visual Studio to use the versions you installed… Note you can find it in the MSVS Options area after it is installed… Or direct from the Extensions menu:
You’ll click <add new Qt version> to configure and add your installed versions and locations.
Ok, now going back to the 3ds Max project, and trying to build… In the options for “Build and Run” you will see two drop downs titled “MSBuild project build output verbosity” and for me was set to “Minimal” where I got this output:
Note the two Qt commands at beginning… Those are output from the 3ds Max Project file. They are one after another, then the error occurs 2x times. At first I did not think of Qt being an issue, but after we change the MSVS output option to be “Detailed” we get a lot more information in the output window. It takes a close eye, but I was suspecting Qt now (because other non-Qt projects were building fine). So, in the output Window I did a search for Qt (Ctrl-F), and bam… right away I see some suspicious issues for example:
1>Property reassignment: $(QtMigrateLib)="D:\me\3dsmax\maxsdk2022\maxsdk\QtWinMigrate\lib\" (previous value: "D:\me\QtWinMigrate\lib\") at D:\me\3dsmax\maxsdk2022\maxsdk\ProjectSettings\PropertySheets\3dsmax.general.project.settings.props (237,3)
Notice it is coming from the maxsdk\ProjectSettings\PropertySheets\3dsmax.general.project.settings.props file…
Later (towards end where the actual build errors are) I also see the calls to Qt uic.exe and moc.exe tools for this project. For example:
1> "D:\me\3dsmax\maxsdk2022\maxsdk\Qt\5.15.1\\bin\uic.exe" -o ".\GeneratedFiles\ui_QtPluginRollup.h" "D:\work\sfdc\case17823411\qtObjectDemo\QtPluginRollup.ui"
Here’s where the problem is… Notice that the front part of the path is 3ds Max SDK, but second part is the versioned Qt path (but missing a Qt platform). This is not the correct way to find Qt. I found that in the 3dsmax.general.project.settings.props file that 3ds Max team is setting Qt values to be relative to the 3ds Max SDK path. For example: <QTDIR Condition="'$(IsDefaultQtVsProjectFormat)' == 'false'">$([MSBuild]::ValueOrDefault(`$(QTDIR)`, `$(MaxSdkDir)Qt\$(QTVER)\`))</QTDIR>
That evaluates to something like this: D:\me\3dsmax\maxsdk2022\maxsdk\Qt\5.15.1\\bin\uic.exe and is wrong.
There are two problems here… There is the 3ds Max SDK path, and even if we installed there, it could be an issue because there is no Qt “platform” folder in that evaluation.
What is the solution? Well, I found that the easiest was just to set the QTDIR from my VS environment (ie. a VS2019 command prompt). You could also change the QTDIR value in the 3dsmax.general.project.settings.props file, but that means changing source SDK files, which I always try to avoid (being in support, I want what is shipped, and could also be issues if trying to setup a new environment, how do you remember to change that again?) The local environment variable does not require changes to the 3ds Max SDK props file.
For example in a VS2019 command prompt, I was able to: set QTDIR=D:\cc\qt\5.15.1\msvc2019_64 and this overrides the props setting when loading the project from that environment.
I'd be interested to here your feedback or if you found a better way, so feel free to leave a comment.