Error with 'string.h' file when building model with Visual Studio 2017
6 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
MathWorks Support Team
le 19 Juil 2019
Réponse apportée : MathWorks Support Team
le 5 Août 2019
I have a model which worked fine in R2017a using Windows SDK 7.1 I am upgrading to R2018b and am now using Visual Studio 2017 Pro as my compiler. However, when I try to build the model, I get an error that mentions the include file 'string.h' being unfound.

Réponse acceptée
MathWorks Support Team
le 6 Août 2019
Here is a basic test you can try:
Please download the attached 'stringtest.c' file and put it in a directory to which you can cd from the Windows Command prompt. Then, open up a normal instance of 'cmd.exe' (_*not *_the Visual Studio Developer Command Prompt). Please cd into that directory where the file is and run the following:
call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Auxiliary\Build\VCVARSALL.BAT " amd64
cl stringtest.c
This should compile the .C file. Otherwise you will get the same error you have seen related to 'string.h'. If the test succeeds, then you should see something like:
L:\>cl stringtest.c
Microsoft (R) C/C++ Optimizing Compiler Version 19.16.27031.1 for x64
Copyright (C) Microsoft Corporation. All rights reserved.
stringtest.c
Microsoft (R) Incremental Linker Version 14.16.27031.1
Copyright (C) Microsoft Corporation. All rights reserved.
/out:stringtest.exe
stringtest.obj
If the test fails, then this may be a Microsoft issue. As you may notice, the test does not include any MATLAB code, but rather MATLAB is just calling Microsoft's 'vcvarsall.bat' file and then attempting to compile a test file. It may be a good idea for you to reach out to Microsoft in this case, as they might know how to resolve the issue more quickly. What you will want to ask them is essentially why the INCLUDE environment variable does not have the win10 SDK paths added to it by 'vcvarsall.bat'. You can show them this test. After running the 'vcvarsall.bat' file, if you run echo %INCLUDE% you should see a path like the following among what gets added:
C:\Program Files (x86)\Windows Kits\10\Include\10.0.17134.0
Another thing you can try is to use elevated privileges. It is possible that 'vcvarsall.bat' does what MATLAB expects when the shell has elevated permissions. If this is the case, then I definitely suggest reaching out to Microsoft's Technical Support, since MathWorks does not expect or rely on that to be run with elevated permissions. As far as MATLAB goes, if you launch it as an administrator, then any shell MATLAB spins off will inherit the same elevated permissions. Thus as long as this holds true on your system, launching MATLAB as an administrator might be a workaround you can use until you get the 'vcvarsall.bat' permission issue sorted out.
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Install Products dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!