Vtk 9.3.1 compilation issue with Visual Studio 2022

I’m trying to compile VTK9.3.1 along with Qt 6.7.3 using Visual Studio 2022. I’m getting this error “vtkDepthPeelingPassIntermediateFS.h(6,1): error C1070: mismatched #if/#endif pair in file”
Is there any solution of this ?

And, The interesting thing is, It is compiling when I use terminal but not when I use VisualStudio 2022 IDE.

Since vtkDepthPeelingPassIntermediateFS.h is generated during the build, the most likely reason for the error is that it wasn’t generated completely. Just delete this file and build again, it will be located somewhere in your build folder.

Thanks for the suggestion David but still it is doesn’t work.

Can you post the contents of the file? Just so that I can verify that it wasn’t incorrectly generated.

// SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
// SPDX-License-Identifier: BSD-3-Clause
#ifndef vtkDepthPeelingPassIntermediateFS_h
#define vtkDepthPeelingPassIntermediateFS_h

extern const char *vtkDepthPeelingPassIntermediateFS;

#endif

Yes, for VTK 9.3.1, those are the correct file contents. Your build is breaking on line six according to the error: vtkDepthPeelingPassIntermediateFS.h(6,1)

I don’t know why this build error would happen, since this line has no #if or #endif. I don’t use the Visual Studio IDE, myself, only msbuild and ninja.

Apply the updates to your Visual Studio, perhaps there was a bug that Microsoft has fixed.