Question about the error for 'mex matsmile.cpp'

The engine.
Post Reply
xiayuqier722
Posts: 1
Joined: Mon Sep 16, 2024 9:39 am

Question about the error for 'mex matsmile.cpp'

Post by xiayuqier722 »

Now For my PhD thesis I am trying to use Smile to link MatLAB with GeNIe for BN model demonstration.

To identify the file location my input is (without this there would be another error to show failed to find the license, etc.):
mex matsmile.cpp -I"C:\Setup\smile-academic-2.2.5-win-vs2022" -L"C:\Setup\smile-academic-2.2.5-win-vs2022" -lsmile_dyn_vc_143x64

However, even all language version are consistent on 2022 (I even tried Matlab 2022 and 2024 two versions), there is still an error (see below). I tried a lot use ChatGPT to debug, but cannot help. Also I am sure my C++ works well since I am working on other programming as well.
Error using mex
matsmile.cpp
C:\Setup\smile-academic-2.2.5-win-vs2022\autolink.h(20): fatal error C1189: #error: Your version of Visual C++ is not supported
Error in Smile_Start (line 1)
mex matsmile.cpp -I"C:\Setup\smile-academic-2.2.5-win-vs2022" -L"C:\Setup\smile-academic-2.2.5-win-vs2022" -lsmile_dyn_vc_143x64



Could anyone may concerned please give me some clue for me to check more for potential issues?

Many thanks! Looking forward to your feedback.
shooltz[BayesFusion]
Site Admin
Posts: 1457
Joined: Mon Nov 26, 2007 5:51 pm

Re: Question about the error for 'mex matsmile.cpp'

Post by shooltz[BayesFusion] »

The error message you're getting is caused by one of SMILE headers comparing Visual C++ compiler version with know versions list. If you're using
Visual Studio 2022 version 17.10, _MSC_VER is defined as 1940, which is outside of the range expected by SMILE's autolink.h header. To fix the problem, replace the following line in autolink.h in your SMILE directory:

Code: Select all

#if (_MSC_VER>=1930 && _MSC_VER<1940)
with

Code: Select all

#if (_MSC_VER>=1930 && _MSC_VER<1949)
Please note that Visual Studio 2019 and earlier have never bumped their initial _MSC_VER as much as VStudio 2022. For example. VStudio 2019 started its _MSC_VER at 1920 released, and its last update had _MSC_VER at 1929. The "1949" in the autolink.h edit is just a guess - we don't know if VStudio 2022 will get multiple updates in the future.

For more info regarding _MSC_VER, refer to Microsoft docs:
https://learn.microsoft.com/en-us/cpp/o ... w=msvc-170
Post Reply