Just wanted to flag a fairly niche issue we ran into with the Projucer at Cakewalk recently. We’re targeting multiple architectures on Windows (x64 and ARM64EC, but any two will cause the problem), and also using a precompiled header, which results in Projucer emitting a malformed Visual Studio project that won’t open.
I’ve described the issue more thoroughly on GitHub here:
opened 03:06PM - 06 Mar 25 UTC
### Detailed steps on how to reproduce the bug
**Steps to Repro**
See jucer fi… le in first comment for an easy repro example.
1. Create a new blank project in Projucer
2. Create a Visual Studio 2022 exporter
3. Create a new header file
4. In the Visual Studio 2022 exporter (Debug or Release) enable "Use Precompiled Header", and...
5. Select more than one Architecture (x64 and ARM64EC is our use case, but any two will do)
6. Save and open in IDE
**Result**
vcxproj file is malformed and the solution/project will not open. The following is emitted in the `ItemGroup` containing all source to compile:
```
<ClCompile Include=".\JucePrecompiledHeader_Debug.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64EC'">Create</PrecompiledHeader>
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64EC'">JucePrecompiledHeader_Debug.h</PrecompiledHeaderFile>
<PrecompiledHeaderOutputFile Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64EC'">$(Platform)\$(Configuration)\JucePrecompiledHeader.pch</PrecompiledHeaderOutputFile>
<ForcedIncludeFiles Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64EC'">JucePrecompiledHeader_Debug.h</ForcedIncludeFiles>
</ClCompile>
<ClCompile Include=".\JucePrecompiledHeader_Debug.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">JucePrecompiledHeader_Debug.h</PrecompiledHeaderFile>
<PrecompiledHeaderOutputFile Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(Platform)\$(Configuration)\JucePrecompiledHeader.pch</PrecompiledHeaderOutputFile>
<ForcedIncludeFiles Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">JucePrecompiledHeader_Debug.h</ForcedIncludeFiles>
</ClCompile>
```
Note that there are two `ClCompile` entries for the debug PCH file.
### What is the expected behaviour?
Valid output would look like this (and adjusting to this manually fixes the project):
```
<ClCompile Include=".\JucePrecompiledHeader_Debug.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64EC'">Create</PrecompiledHeader>
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64EC'">JucePrecompiledHeader_Debug.h</PrecompiledHeaderFile>
<PrecompiledHeaderOutputFile Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64EC'">$(Platform)\$(Configuration)\JucePrecompiledHeader.pch</PrecompiledHeaderOutputFile>
<ForcedIncludeFiles Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64EC'">JucePrecompiledHeader_Debug.h</ForcedIncludeFiles>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">JucePrecompiledHeader_Debug.h</PrecompiledHeaderFile>
<PrecompiledHeaderOutputFile Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(Platform)\$(Configuration)\JucePrecompiledHeader.pch</PrecompiledHeaderOutputFile>
<ForcedIncludeFiles Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">JucePrecompiledHeader_Debug.h</ForcedIncludeFiles>
</ClCompile>
```
i.e., the various platform specific entries should be placed within the same `ClCompile` entry, rather than creating multiple `ClCompile` entries for the same platform.
Note that this behavior is already correct for other source files, and is only broken for precompiled headers.
### Operating systems
Windows
### What versions of the operating systems?
I'm on Windows 11 build 27788 (latest Canary channel build), but this is happening for team members on older builds, too.
### Architectures
x86_64, Arm64/aarch64, Arm64EC (Windows)
### Testing on the `develop` branch
The bug is present on the `develop` branch
### Code of Conduct
- [x] I agree to follow the Code of Conduct
Basically, Projucer creates multiple ClCompile entries for the PCH, instead of putting all of the targets in a single entry.
I’ve contributed a fix here:
develop ← ryaanahmed-bl:fix/projucer-multiple-platform-pch-msvc
opened 07:55PM - 06 Mar 25 UTC
A project with a precompiled header and multiple platforms selected for a single… configuration would result in multiple ClCompile entries in the Visual Studio project file, which is an invalid file state and would not open in Visual Studio.
Projucer now correctly emits a single ClCompile entry for the PCH, including entries for all target platforms.
Fixes #1519
We’re not blocked by this, as we’ve patched it in our own fork of JUCE, but just flagging this fix here in case other folks are running into the same problem.
Cheers!
Ryaan
1 Like
oli1
April 25, 2025, 1:03pm
2
Thanks for reporting this. The changes can be found on develop
committed 01:57PM - 24 Apr 25 UTC
Co-authored-by: Ryaan Ahmed <ryaan.ahmed@bandlab.com>