Need Help to Resolve CMake Error while Opening the blender-git/blender directory in Visual Studio

Hello, I am new to Blender development and trying to set up the development environment on my Windows 11 system. I have followed the document instructions in the following sequence:

  1. [Building Blender > Windows]
  2. [Development Environment > Visual Studio]
  3. [Contributing Code > Pull Request]

However, when I open the folder(…/blender-git/blender) in Visual Studio, I receive the following error:

CMake Error at C:/Program Files/Microsoft Visual Studio/2022/Community/Common7/IDE/CommonExtensions/Microsoft/CMake/CMake/share/cmake-3.29/Modules/CMakeTestCCompiler.cmake:67 (message):
  The C compiler
    "C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.42.34433/bin/Hostx64/x64/cl.exe"
is not able to compile a simple test program.
  It fails with the following output:
    Change Dir: 'D:/blender-git/blender/out/build/x64-Debug/CMakeFiles/CMakeScratch/TryCompile-hkyryf'
Run Build Command(s): 
...
RC Pass 1: command "rc /fo CMakeFiles\cmTC_b97fe.dir/manifest.res CMakeFiles\cmTC_b97fe.dir/manifest.rc" failed (exit code 0) with the following output:
    no such file or directory
    ninja: build stopped: subcommand failed.

  CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
  CMakeLists.txt:113 (project)

What should I do next? Should I address this error, or is it safe to ignore?
Due to the constraints in composing this message I have shared the complete error message here.

What happens if you follow our build instructions and use make.bat to build blender?

https://developer.blender.org/docs/handbook/building_blender/windows/

I followed the document and successfully built the project using make. The build process completed properly, displaying the message -- Installing: .... at the end. When I open blender.exe, Blender works as expected.

However, the error message mentioned above appears in Visual Studio when I try to open the ‘…/blender-git/blender’ folder in Visual Studio.

Then don’t, follow the instructions instead. Visual Studio - Blender Developer Documentation

1 Like

Tried that as well. I think the issue is related to CMake, although I have installed it properly and there is hardly any alternative left without addressing the issue directly.

To be clear, you should open the Blender.sln file in Visual Studio, not open a folder.

1 Like