# SystemModeler compiler can't find inttypes.h?

**URL:** <https://community.wolfram.com/t/systemmodeler-compiler-cant-find-inttypes-h/19187>\
**Category:** Questions\
**Tags:** external-interfaces, modeling, system-modeler\
**Created:** [November 29, 2021, 7:53pm UTC](https://community.wolfram.com/t/systemmodeler-compiler-cant-find-inttypes-h/19187 "2021-11-29T19:53:35Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![mmacenaeng](https://avatars.discourse-cdn.com/v4/letter/m/a6a055/32.png) [@mmacenaeng](https://community.wolfram.com/u/mmacenaeng)\
**Post date:** [November 29, 2021, 7:53pm UTC](https://community.wolfram.com/t/systemmodeler-compiler-cant-find-inttypes-h/19187/1 "2021-11-29T19:53:35Z")

</div>

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:

 ![SM_compiler.PNG](https://global.discourse-cdn.com/wolfram/original/3X/3/a/3aa7445177230230b3c9f789d75303c047022a8a.png)

And here is the compiler error:

 ![SM_compiler_error.png](https://global.discourse-cdn.com/wolfram/original/3X/4/f/4f9d9cef89890241a23a3fc6b8a831a121af8f35.png)

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**.

System:

Product version: 12.3.1.7

Client: Model Center

Client version: 12.3.1.6

Client creation date: 2021-06-07T11:45:13.640000

Client build revisions: S:1b0160c02, J:1dbf5d051, L:38c242434

Client build type: 64 bit

Kernel version: 12.3.1.7

Kernel creation date: 2021-05-27T14:59:37.824000

Kernel build revisions: S:745840ba9, J:84e3d9a4b, L:38c242434

Kernel root directory: C:\Program Files\Wolfram Research\SystemModeler 12.3.1

Installation directory: C:\Program Files\Wolfram Research\SystemModeler 12.3.1

Platform: Windows 10 Version 1909

---

<div class="post-metadata">

**Author:** ![ottot](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/ottot/32/10183_2.png) [@ottot](https://community.wolfram.com/u/ottot)\
**Post date:** [November 30, 2021, 7:52am UTC](https://community.wolfram.com/t/systemmodeler-compiler-cant-find-inttypes-h/19187/2 "2021-11-30T07:52:06Z")

</div>

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.

Otto

---

<div class="post-metadata">

**Author:** ![mmacenaeng](https://avatars.discourse-cdn.com/v4/letter/m/a6a055/32.png) [@mmacenaeng](https://community.wolfram.com/u/mmacenaeng)\
**Post date:** [November 30, 2021, 8:05pm UTC](https://community.wolfram.com/t/systemmodeler-compiler-cant-find-inttypes-h/19187/3 "2021-11-30T20:05:11Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![ottot](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/ottot/32/10183_2.png) [@ottot](https://community.wolfram.com/u/ottot)\
**Post date:** [December 1, 2021, 8:11am UTC](https://community.wolfram.com/t/systemmodeler-compiler-cant-find-inttypes-h/19187/4 "2021-12-01T08:11:55Z")

</div>

The `HAVE_INTTYPES_H` macro is set because Visual Studio should have the `inttypes.h` header since VS2013.

Just to make sure did you verify that the selected compiler was changed to you newly installed VS 2017?

 ![Screenshot2021-12-01at08.35.58.png](https://global.discourse-cdn.com/wolfram/original/3X/a/a/aa517468927a2368b005c119cb713c92ea7f86da.png)

> 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

 ![Screenshot2021-12-01at09.06.55.png](https://global.discourse-cdn.com/wolfram/original/3X/5/2/5283dfb11e13a3b9fa5576de7c2c07b1480f9621.png)

---

<div class="post-metadata">

**Author:** ![mmacenaeng](https://avatars.discourse-cdn.com/v4/letter/m/a6a055/32.png) [@mmacenaeng](https://community.wolfram.com/u/mmacenaeng)\
**Post date:** [December 1, 2021, 2:26pm UTC](https://community.wolfram.com/t/systemmodeler-compiler-cant-find-inttypes-h/19187/5 "2021-12-01T14:26:47Z")

</div>

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.

 ![VS2019_print.PNG](https://global.discourse-cdn.com/wolfram/original/2X/a/a0f58bf07ce1bd0c4e15a27f01e7464864240cd8.png)

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.

**EDIT 2:** I found **inttypes.h** , is at:

_C:\Program Files (x86)\Windows Kits\10\Include\10.0.10240.0\ucrt_

I added this path with the **/I** flag in a custom compiler setting:

 ![VS2019_print_2.PNG](https://global.discourse-cdn.com/wolfram/original/3X/f/b/fb2e2520aaeeb7dd00353e991712915e62dc006d.png)

After that the error changes:

 ![SM_compiler_error_2.PNG](https://global.discourse-cdn.com/wolfram/original/2X/a/a87ff71159f8c0b683c4411c1983b8570e01738a.png)

It said that it could not open the file, also in the folders:

_C:\Program Files\Wolfram Research\SystemModeler 12.3.1\lib\win64\VS2019_

and

_C:\Program Files\Wolfram Research\SystemModeler 12.3.1\lib\win64\VS2019\msl\3.2.3_

there is no **libucrt.lib** file.

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. ?

---

<div class="post-metadata">

**Author:** ![mmacenaeng](https://avatars.discourse-cdn.com/v4/letter/m/a6a055/32.png) [@mmacenaeng](https://community.wolfram.com/u/mmacenaeng)\
**Post date:** [December 6, 2021, 5:53pm UTC](https://community.wolfram.com/t/systemmodeler-compiler-cant-find-inttypes-h/19187/6 "2021-12-06T17:53:05Z")

</div>

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):

_**C:\Program Files (x86)\Windows Kits\10\Include**_

There is a folder for each version:

 ![toolkits_print.PNG](https://global.discourse-cdn.com/wolfram/original/2X/e/e61315d4566d157810bb813b089f592a3d36a513.png)

**Solution:**

1. Select **custom** setup for the compiler;
2. Add **-winsdk=10.0.19041.0** command to the line **“Visual C++ setup script arguments”** ;
3. Click **Verify Compiler** , it is expected to succeed;
4. Click **OK**.

My compiler options screen after setup:

 ![SM_compiler_2.PNG](https://global.discourse-cdn.com/wolfram/original/3X/2/f/2fd8e27ea584b94dcff37cbdc9f3ac604846aec6.png)

Hope this helps anyone with the same problem!

Relevant link:  
[https://renenyffenegger.ch/notes/Windows/dirs/Program-Files-x86/Microsoft-Visual-Studio/version/edition/Common7/Tools/VsDevCmd\_bat](https://renenyffenegger.ch/notes/Windows/dirs/Program-Files-x86/Microsoft-Visual-Studio/version/edition/Common7/Tools/VsDevCmd_bat)

---

<div class="post-metadata">

**Author:** ![ottot](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/ottot/32/10183_2.png) [@ottot](https://community.wolfram.com/u/ottot)\
**Post date:** [December 7, 2021, 12:29pm UTC](https://community.wolfram.com/t/systemmodeler-compiler-cant-find-inttypes-h/19187/7 "2021-12-07T12:29:49Z")

</div>

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 `-winsdk` `VsDevCmd.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.

Otto

---

<div class="post-metadata">

**Author:** ![mmacenaeng](https://avatars.discourse-cdn.com/v4/letter/m/a6a055/32.png) [@mmacenaeng](https://community.wolfram.com/u/mmacenaeng)\
**Post date:** [December 7, 2021, 1:28pm UTC](https://community.wolfram.com/t/systemmodeler-compiler-cant-find-inttypes-h/19187/8 "2021-12-07T13:28:26Z")

</div>

You’re welcome.

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.

10.0.22000.0 folder:

![folder_10.0.22000.0.PNG](https://global.discourse-cdn.com/wolfram/original/3X/f/d/fd0f4a5f2a7b6c70c36aba4b149813b42314d46b.png)

10.0.19041 folder:

 ![folder_10.0.19041.PNG](https://global.discourse-cdn.com/wolfram/original/3X/d/2/d21b121f242296167d00493e3dbf86d361e0dac7.png)
