Why is clibgen.ge​nerateLibr​aryDefinit​ion throwing errors after Matlab - MSVC upgrade ?

I have a C++ library that I interface with using clibgen. Back in 2023, I used MSVC 142 and Matlab 2022a to perform the operation and made it work.
I am now using MSVC 143 and Matlab 2024a. I performed a minor update to the C++ library. The C++ build goes smoothly, with no error or warning. However, running clibgen.generateLibraryDefinition throws errors that I did not get before :
Errors parsing interface generation files.
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.44.35207\include\type_traits(2304):
error: operator may not be a static member function
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.44.35207\include\type_traits(2332):
error: operator may not be a static member function
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.44.35207\include\type_traits(2341):
error: operator may not be a static member function
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.44.35207\include\type_traits(2350):
error: operator may not be a static member function
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.44.35207\include\type_traits(2359):
error: operator may not be a static member function
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.44.35207\include\vector(2303):
error: operator may not be a static member function
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.44.35207\include\vector(3621):
error: operator may not be a static member function
As far as I am aware, the errors are pointing to standard headers installed with MSVC 143. Any idea why I am getting these errors now but only in Matlab, not when building my C++ project, and how to fix them ?

2 Comments

I am having this issue too (not exactly same versions but similar story with Matlab 2024B). I contacted support as well.

Sign in to comment.

 Accepted Answer

Hello all,
I've handled the support case created by Teun.
This is the information we have about this issue:
This issue is happening due to a change in the MSVC compiler where static operator methods are accepted in pre-C++23 modes. MATLAB versions before R2025b do not expect this new behavior, leading to these errors.
Please downgrade to a pre-14.44 version of MSVC 2022 as a workaround in MATLAB versions before R2025b. Note, that you cannot select between multiple installed versions of MSVC 2022, you need to either uninstall the affected 14.44 or later version or switch to a different supported compiler, such as MSVC 2019 (depending on the release you are using).
Michael

More Answers (0)

Products

Release

R2024a

Tags

Asked:

on 31 Aug 2026

Answered:

on 14 Oct 2026 at 9:20

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!