Library compiler C packaging error

3 次查看(过去 30 天)
GUS
GUS 2022-6-24
回答: Ramtej 2023-9-15
Preparing Runtime...
mcc -W 'lib:magicsquare,version=1.0' -T link:lib -d C:\Users\user\Desktop\magicsquare\for_testing -v C:\Users\user\Desktop\magicsquare.m
Compiler version: 8.0 (R2020a)
Dependency analysis by REQUIREMENTS.
Parsing file "C:\Users\user\Desktop\magicsquare.m"
(referenced from command line).
Generating file "C:\Users\user\Desktop\magicsquare\for_testing\magicsquare.h".
Generating file "C:\Users\user\Desktop\magicsquare\for_testing\magicsquare.c".
Generating file "C:\Users\user\Desktop\magicsquare\for_testing\magicsquare.exports".
Generating file "C:\Users\user\Desktop\magicsquare\for_testing\readme.txt".
Executing command: ""C:\Program Files\MATLAB\R2020a\bin\mbuild" -client mbuild -O -v -output "magicsquare" -I"C:\Users\user\Desktop\magicsquare\for_testing" "C: \Users\user\Desktop\magicsquare\for_testing\magicsquare.c" DEFFILE"=""C:\Users\user\Desktop\magicsquare\for_testing\magicsquare.def""" LINKEXPORT"=""/DLL /def:\ "$DEFFILE\"""" LDEXT"="".dll""" LDTYPE"="" -shared -static""" MTCMDLINE"=""mt -outputresource:$EXE;2 -manifest $MANIFEST""" -outdir "C:\Users\user\Desktop\magicsquare\for_testing""
Show details mode is on.
MEX options file not identified. Instead, it looks for an implicit choice.
... looking for compiler 'Intel Parallel Studio XE 2017 with Microsoft Visual Studio 2015 (C)'...
...finding environment variable 'ICPP_COMPILER17'...No.
No installed compiler 'Intel Parallel Studio XE 2017 with Microsoft Visual Studio 2015 (C)' was found.
... looking for compiler 'Intel Parallel Studio XE 2017 with Microsoft Visual Studio 2017 (C)'...
...finding environment variable 'ICPP_COMPILER17'...No.
No installed compiler 'Intel Parallel Studio XE 2017 with Microsoft Visual Studio 2017 (C)' was found.
... looking for compiler 'Intel Parallel Studio XE 2017 with Microsoft Visual Studio 2019 (C)'...
...finding environment variable 'ICPP_COMPILER17'...No.
No installed compiler 'Intel Parallel Studio XE 2017 with Microsoft Visual Studio 2019 (C)' was found.
... looking for compiler 'Intel Parallel Studio XE 2018 with Microsoft Visual Studio 2015 (C)'...
...finding environment variable 'ICPP_COMPILER18'...No.
No installed compiler 'Intel Parallel Studio XE 2018 with Microsoft Visual Studio 2015 (C)' was found.
... looking for compiler 'Intel Parallel Studio XE 2018 with Microsoft Visual Studio 2017 (C)'...
...finding environment variable 'ICPP_COMPILER18'...No.
No installed compiler 'Intel Parallel Studio XE 2018 with Microsoft Visual Studio 2017 (C)' was found.
... looking for compiler 'Intel Parallel Studio XE 2018 with Microsoft Visual Studio 2019 (C)'...
...finding environment variable 'ICPP_COMPILER18'...No.
No installed compiler 'Intel Parallel Studio XE 2018 with Microsoft Visual Studio 2019 (C)' was found.
... looking for compiler 'Intel Parallel Studio XE 2019 with Microsoft Visual Studio 2015 (C)'...
...finding environment variable 'ICPP_COMPILER19'...No.
No installed compiler 'Intel Parallel Studio XE 2019 with Microsoft Visual Studio 2015 (C)' was found.
... looking for compiler 'Intel Parallel Studio XE 2019 with Microsoft Visual Studio 2017 (C)'...
...finding environment variable 'ICPP_COMPILER19'...No.
No installed compiler 'Intel Parallel Studio XE 2019 with Microsoft Visual Studio 2017 (C)' was found.
... looking for compiler 'Intel Parallel Studio XE 2019 with Microsoft Visual Studio 2019 (C)'...
...finding environment variable 'ICPP_COMPILER19'...No.
No installed compiler 'Intel Parallel Studio XE 2019 with Microsoft Visual Studio 2019 (C)' was found.
... looking for compiler 'Intel Parallel Studio XE 2020 with Microsoft Visual Studio 2017 (C)'...
...finding environment variable 'ICPP_COMPILER20'...No.
No installed compiler 'Intel Parallel Studio XE 2020 with Microsoft Visual Studio 2017 (C)' was found.
... looking for compiler 'Intel Parallel Studio XE 2020 with Microsoft Visual Studio 2019 (C)'...
...finding environment variable 'ICPP_COMPILER20'...No.
No installed compiler 'Intel Parallel Studio XE 2020 with Microsoft Visual Studio 2019 (C)' was found.
... looking for compiler 'MinGW64 Compiler (C)'...
...finding environment variable 'MW_MINGW64_LOC'...No.
Could not find installed compiler 'MinGW64 Compiler (C)'.
... looking for compiler 'Microsoft Visual C++ 2015 (C)'...
... looking for registry setting 'HKLM\SOFTWARE\Microsoft\VisualStudio\SxS\VC7' 14.0...No.
... looking for registry setting 'HKCU\SOFTWARE\Microsoft\VisualStudio\SxS\VC7' 14.0...No.
... looking for registry setting 'HKLM\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\SxS\VC7' 14.0...No.
... looking for registry setting 'HKCU\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\SxS\VC7' 14.0...No.
No installed compiler 'Microsoft Visual C++ 2015 (C)' was found.
... looking for compiler 'Microsoft Visual C++ 2017 (C)'...
... looking for registry setting 'HKLM\SOFTWARE\Microsoft\VisualStudio\SxS\VS7' 15.0...No.
... looking for registry setting 'HKCU\SOFTWARE\Microsoft\VisualStudio\SxS\VS7' 15.0...No.
... looking for registry setting 'HKLM\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\SxS\VS7' 15.0...No.
... looking for registry setting 'HKCU\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\SxS\VS7' 15.0...No.
********* No supported compiler found. You can install the free MinGW-w64 C/C++ compiler. Visit https://www.mathworks.com/help/matlab/matlab_external/install-mingw-support-package.html. See https://www.mathworks.com/support/compilers for more options.
No installed compiler 'Microsoft Visual C++ 2017 (C)' was found.
... looking for compiler 'Microsoft Visual C++ 2019 (C)'...
...finding environment variable 'ProgramFiles(x86)'...Yes ('C:\Program Files (x86)').
... looking for file 'C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe'...No.
...finding environment variable 'ProgramFiles(x86)'...Yes ('C:\Program Files (x86)').
... looking for file 'C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe'...No.
...finding environment variable 'ProgramFiles(x86)'...Yes ('C:\Program Files (x86)').
... looking for file 'C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe'...No.
No installed compiler 'Microsoft Visual C++ 2019 (C)' was found.
... looking for compiler 'Microsoft Visual C++ 2019 (C)'...
...finding environment variable 'ProgramFiles(x86)'...Yes ('C:\Program Files (x86)').
... looking for file 'C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe'...No.
...finding environment variable 'ProgramFiles(x86)'...Yes ('C:\Program Files (x86)').
... looking for file 'C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe'...No.
...finding environment variable 'ProgramFiles(x86)'...Yes ('C:\Program Files (x86)').
... looking for file 'C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe'...No.
No installed compiler 'Microsoft Visual C++ 2019 (C)' was found.
********* The following command:
""C:\Program Files\MATLAB\R2020a\bin\mbuild" -client mbuild -O -v -output "magicsquare" -I"C:\Users\user\Desktop\magicsquare\for_testing" "C:\Users\ user\Desktop\magicsquare\for_testing\magicsquare.c" DEFFILE"=""C:\Users\user\Desktop\magicsquare\for_testing\magicsquare.def""" LINKEXPORT"=""/DLL /def:\"$DEFFILE \"""" LDEXT"="".dll""" LDTYPE"="" -shared -static""" MTCMDLINE"=""mt -outputresource:$EXE;2 -manifest $MANIFEST""" -outdir " C:\Users\user\Desktop\magicsquare\for_testing""
failed with error code -1.
to learn how to use the library compiler, I tried packaging in C language by making a magic square function.
However, the following error is appearing:
According to the error, MinGW was installed through the link, but the same problem is appearing.
Could someone give me a solution?
my matlab version is R2020a
  1 个评论
GUS
GUS 2022-6-24
编辑:GUS 2022-6-24
my function code is as follow:
function m = magicsquare(n)
if ischar(n)
n=str2double(n);
end
m = magic(n)

请先登录,再进行评论。

回答(1 个)

Ramtej
Ramtej 2023-9-15
Hi GUS,
As per my understanding, you are trying to learn how to use the MATLAB library compiler by creating a C shared library.
You can leverage the below documentation for the detailed instructions on how to create a C shared library and troubleshoot compilation failures.
Hope this helps!

类别

Help CenterFile Exchange 中查找有关 C Shared Library Integration 的更多信息

产品


版本

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by