gpucoder error: Cannot open include file: 'stdio.h': No such file or directory

21 views (last 30 days)
I'm using VS 2017 community and Windows SDK 10
I'm trying to build a mex file using gpucoder, I'm getting this error
C:\Program Files\MATLAB\R2021b\extern\include\mex.h(38): fatal error C1083: Cannot open include file: 'stdio.h': No such file or directory
While tracing I found the error due to the line
cl /c /Zp8 /GR /W3 /EHs /nologo /MD /D_CRT_SECURE_NO_DEPRECATE /D_SCL_SECURE_NO_DEPRECATE /D_SECURE_SCL=0 /DMATLAB_MEX_FILE /DMATLAB_MEX_FILE /O2 /Oy- /DNDEBUG /fp:strict /source-charset:utf-8 /I "." /I "E:\Hatem\BarrierBox" /I ".\interface" /I "C:\Program Files\MATLAB\R2021b\extern\include" /I "." -DHAVE_LAPACK_CONFIG_H -DLAPACK_COMPLEX_STRUCTURE -DMW_HAVE_LAPACK_DECLS -DMW_CUDA_ARCH=350 -DMODEL=chol_call_mex -DMW_NEEDS_VERSION_H interface\_coder_chol_call_info.cpp /Fobuild\win64\_coder_chol_call_info.obj
I added
/I "C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\ucrt"
and I got this error:
C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\ucrt\corecrt.h(10): fatal error C1083: Cannot open include file: 'vcruntime.h': No such file or directory
I added
/I "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\include"
and it works
Is there a better solution to automatically generate the command lines to use these include folders?
Thank you.

Answers (1)

Infinite_king
Infinite_king on 5 Dec 2023
Hi Hatem Fayed,
I understand that you are attempting to generate a GPU MEX using GPU Coder, and you've encountered a 'Cannot open include file' error. To address this, you manually provided the include directory path, which resolved the issue.
Typically, there's no need to explicitly specify include directory paths. One possible reason for encountering this error is an incorrect configuration of the C/C++ compiler. To set the default C/C++ compiler that should be used by GPU coder, enter the below command and follow the instructions shown in the screen.
% to select c compiler
mex -setup c
% to select C++ compilelr
mex -setup cpp
After this you can use the GPU Coder through command prompt as follows,
codegen -config coder.gpuConfig('mex') -args {Arg1,Arg2} function_name
For more information on Compiler setup, refer the following MATLAB documentation,
For more information on ‘codegen’ usage, refer the following MATLAB documentation,
Hope this is helpful.

Categories

Find more on Troubleshooting in MATLAB Compiler SDK in Help Center and File Exchange

Products


Release

R2021b

Community Treasure Hunt

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

Start Hunting!