I tried to compile a co-simulation FMU (2.0) and the compiler complains that inttypes.h
is missing. The same error ocurred when I try to run any model. Here is the compiler settings:
There is a macro in modelica_types.h: HAVE_INTTYPES_H and seems to me
that it is defined somewhere else, so the compiler tries to compile with this header but doesn’t find it. I inspected the folder of modelica_types.h but didn’t see any inttypes.h.
You are most likely missing a necessary component of Visual Build Tools. I would suggest that you install the compiler by pressing the “Check for Compatible Compiler” button in the dialog shown above. This will preselect the necessary components of Visual Studio Build Tools that you need to install.
As soon as I finished SM installation, it prompted me to set a compiler. I let
it choose and the first option was VS 2019 version, than a I did as you told,
I’ve clicked in “check for compatible compiler” and it asked me to install VS 2017.
I’ve installed the full “Visual C++ build tools” workload for Vs 2017 and it still fails with the same problem. I couldn’t find inttypes.h header in my computer also, I don’t now why the macro HAVE_INTTYPES_H is set.
I’ve installed the full “Visual C++ build tools” workload for Vs 2017
That is not communicated that clearly, but you are not supposed to change anything during the installation, the necessary components should be preselected.
For me the component that seems to add the inttypes.h file is Windows Universal CRT SDK
Ok, I have confused the 12.1 version of SM with 12.3 version, I had both installed.
But I still have the problem. Now in 12.3 version, I checked for compatible compilers and choose visual C++ build tools 2019. Than the main VS screen doesn’t offer anything new to install. And the component that you show is installed. It is in portuguese but you can get it.
PS: I have reinstalled SM 12.3 to try to fix it, but didn’t work.
EDIT: I’ve uninstalled all VS packages and I started SM again, it prompted me to set the compiler and it, as always, opens the VS installer (VS 2019). I just installed everything SM pre-selected and the problem still happens.
Does SM need some environmental variables? for itself or for VS2019 tools ?
Is there any important stuff that SM requires that should be in the PATH env. var. ?
After a week spent on this I could manage to solve the problem. Actually, the problem was with Visual Studio 2019 installation. For some strange reason, the command VsDevCmd messes with all the needed environmental variables to do a proper compilation. It is something related with having more than one version of Windows SDK in the computer. It shouldn’t be a problem as SM “asked” VS2019 the proper setup to compile its files. The toolkit with all needed headers and libraries is the 10.0.19041.0 version. You can find the toolkits in (if you haven’t changed the standard path):
I’m glad that you figured it out and thanks for sharing the solution.
That the old 10.0.10240.0 doesn’t work isn’t that surprising, this was back in the day with VS2015 and then perhaps some of the libraries came with the compiler.
I’m still perplexed by the fact that it doesn’t work out of the box for you, if you don’t specify -winsdkVsDevCmd.bat is supposed to select the newest as far as I can tell and for you that would be 10.0.22000.0 and that one certainly works for me. According to posts at the Visual Studio community it’s supposed to read that information from the registry: HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Microsoft SDKs\Windows\v10.0
You could take a look there and see which version it points to.
In my HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\MicrosoftSDKs\Windows\v10.0
the version is 10.0.19041. I don’t understand why is not 10.0.22000.0 version. Also, the 10.0.19041 folder have more and different stuff than the 10.0.22000.0 folder.