How to manually edit MatLab Coder .mex-file code to support 64bit indexing

10 次查看(过去 30 天)
Hey,
I have a problem that mex files generated by MatLab Coder only supports 32bit indexing, which is the reason my program gets an error when the input of the bottleneck mex function exceeds an input boolean matrix which has more than 2^31 elements.
I know that mex-files support 64bit indexing when they are hand written, but since I am not comfortable with c or c++, I wonder if there is a way, and if so how, to manually correct this at the end of the coder when it shows me the code it generated?
I read that i shoukld have to replace the 'int32_T' by 'size_t' but thats not all, I would also need to replace the the constructors 'coder::array<T, 1U>' with C MEX API... and thats the point where my knowledge ends and I would need some help about what to do exactly and how to do it.
May be someone coukld help me with that.
Best regards and many thanks in advance

采纳的回答

Nitin Kapgate
Nitin Kapgate 2020-12-18
编辑:Nitin Kapgate 2020-12-18
So you will need to manually change the codein C/C++ files.
You can refer to the guide to enable support for 64-bit indexing in MEX files using compatibleArrayDims flag in mex command.
You can use these additional instructions to upgrade MEX files to use 64-Bit API.
  2 个评论
Marc Laub
Marc Laub 2020-12-23
编辑:Marc Laub 2020-12-23
I first tried to recompile the coder code with matlab again, just to be sure that it will work. Untill this would not work I should not be concerned about changing the code because I cant compile it.
So I tried it but i got tonnes of error messages which I did understand:
>> mex -v *.cpp
Verbose mode is on.
... Looking for compiler 'MinGW64 Compiler (C++)' ...
... Looking for environment variable 'MW_MINGW64_LOC' ...Yes ('C:\ProgramData\MATLAB\SupportPackages\R2020a\3P.instrset\mingw_w64.instrset').
... Looking for file 'C:\ProgramData\MATLAB\SupportPackages\R2020a\3P.instrset\mingw_w64.instrset\bin\g++.exe' ...Yes.
... Looking for folder 'C:\ProgramData\MATLAB\SupportPackages\R2020a\3P.instrset\mingw_w64.instrset' ...Yes.
... Looking for environment variable 'MW_MINGW64_LOC' ...Yes ('C:\ProgramData\MATLAB\SupportPackages\R2020a\3P.instrset\mingw_w64.instrset').
... Executing command 'C:\ProgramData\MATLAB\SupportPackages\R2020a\3P.instrset\mingw_w64.instrset\bin\g++ -dumpmachine' ...Yes ('x86_64-w64-mingw32').
... Looking for environment variable 'MW_MINGW64_LOC' ...Yes ('C:\ProgramData\MATLAB\SupportPackages\R2020a\3P.instrset\mingw_w64.instrset').
... Executing command 'C:\ProgramData\MATLAB\SupportPackages\R2020a\3P.instrset\mingw_w64.instrset\bin\g++ -dumpversion' ...Yes ('6.3.0').
Found installed compiler 'MinGW64 Compiler (C++)'.
Set PATH = C:\ProgramData\MATLAB\SupportPackages\R2020a\3P.instrset\mingw_w64.instrset\bin;C:\Program Files\MATLAB\R2020a\extern\include\win64;C:\Program Files\MATLAB\R2020a\extern\include;C:\Program Files\MATLAB\R2020a\simulink\include;C:\Program Files\MATLAB\R2020a\lib\win64;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files\MATLAB\R2020a\runtime\win64;C:\Program Files\MATLAB\R2020a\bin;C:\Users\mlaub\AppData\Local\Microsoft\WindowsApps;
Set INCLUDE = C:\ProgramData\MATLAB\SupportPackages\R2020a\3P.instrset\mingw_w64.instrset\include;C:\ProgramData\MATLAB\SupportPackages\R2020a\3P.instrset\mingw_w64.instrset\lib\gcc\x86_64-w64-mingw32\6.3.0\include\c++;C:\ProgramData\MATLAB\SupportPackages\R2020a\3P.instrset\mingw_w64.instrset\lib\gcc\x86_64-w64-mingw32\6.3.0\include;C:\ProgramData\MATLAB\SupportPackages\R2020a\3P.instrset\mingw_w64.instrset\lib\gcc\x86_64-w64-mingw32\6.3.0\include\c++\x86_64-w64-mingw32;C:\ProgramData\MATLAB\SupportPackages\R2020a\3P.instrset\mingw_w64.instrset\lib\gcc\x86_64-w64-mingw32\6.3.0\include\c++\backward;C:\ProgramData\MATLAB\SupportPackages\R2020a\3P.instrset\mingw_w64.instrset\x86_64-w64-mingw32\include;C:\ProgramData\MATLAB\SupportPackages\R2020a\3P.instrset\mingw_w64.instrset\include;C:\ProgramData\MATLAB\SupportPackages\R2020a\3P.instrset\mingw_w64.instrset\lib\gcc\x86_64-w64-mingw32\6.3.0\include\c++;C:\ProgramData\MATLAB\SupportPackages\R2020a\3P.instrset\mingw_w64.instrset\lib\gcc\x86_64-w64-mingw32\6.3.0\include;C:\ProgramData\MATLAB\SupportPackages\R2020a\3P.instrset\mingw_w64.instrset\lib\gcc\x86_64-w64-mingw32\6.3.0\include\c++\x86_64-w64-mingw32;C:\ProgramData\MATLAB\SupportPackages\R2020a\3P.instrset\mingw_w64.instrset\lib\gcc\x86_64-w64-mingw32\6.3.0\include\c++\backward;C:\ProgramData\MATLAB\SupportPackages\R2020a\3P.instrset\mingw_w64.instrset\x86_64-w64-mingw32\include;
Set LIB = C:\ProgramData\MATLAB\SupportPackages\R2020a\3P.instrset\mingw_w64.instrset\lib;;C:\ProgramData\MATLAB\SupportPackages\R2020a\3P.instrset\mingw_w64.instrset\lib;;
Set MW_TARGET_ARCH = win64;win64;
Set LIBPATH = C:\Program Files\MATLAB\R2020a\extern\lib\win64;C:\Program Files\MATLAB\R2020a\extern\lib\win64;
Options file details
-------------------------------------------------------------------
Compiler location: C:\ProgramData\MATLAB\SupportPackages\R2020a\3P.instrset\mingw_w64.instrset
Options file: C:\Users\mlaub\AppData\Roaming\MathWorks\MATLAB\R2020a\mex_C++_win64.xml
CMDLINE2 : C:\ProgramData\MATLAB\SupportPackages\R2020a\3P.instrset\mingw_w64.instrset\bin\g++ -m64 -Wl,--no-undefined -shared -static -s -Wl,"C:\Program Files\MATLAB\R2020a/extern/lib/win64/mingw64/exportsmexfileversion.def" C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\grain_struct_grower_para.obj C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\grain_struct_grower_para_mexutil.obj C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\rt_nonfinite.obj C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\_coder_grain_struct_grower_para_info.obj C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\_coder_grain_struct_grower_para_mex.obj C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\cpp_mexapi_version.obj -L"C:\Program Files\MATLAB\R2020a\extern\lib\win64\mingw64" -llibmx -llibmex -llibmat -lm -llibmwlapack -llibmwblas -llibMatlabDataArray -llibMatlabEngine -o grain_struct_grower_para.mexw64
CXX : C:\ProgramData\MATLAB\SupportPackages\R2020a\3P.instrset\mingw_w64.instrset\bin\g++
COMPILER : C:\ProgramData\MATLAB\SupportPackages\R2020a\3P.instrset\mingw_w64.instrset\bin\g++
DEFINES : -DMATLAB_DEFAULT_RELEASE=R2017b -DUSE_MEX_CMD -m64 -DMATLAB_MEX_FILE
MATLABMEX : -DMATLAB_MEX_FILE
CFLAGS : -fexceptions -fno-omit-frame-pointer
CXXFLAGS : -fexceptions -fno-omit-frame-pointer -std=c++11
INCLUDE : -I"C:\Program Files\MATLAB\R2020a/extern/include" -I"C:\Program Files\MATLAB\R2020a/simulink/include"
CXXOPTIMFLAGS : -O2 -fwrapv -DNDEBUG
CXXDEBUGFLAGS : -g
LDXX : C:\ProgramData\MATLAB\SupportPackages\R2020a\3P.instrset\mingw_w64.instrset\bin\g++
LINKER : C:\ProgramData\MATLAB\SupportPackages\R2020a\3P.instrset\mingw_w64.instrset\bin\g++
LDFLAGS : -m64 -Wl,--no-undefined
LDTYPE : -shared -static
LINKEXPORT : -Wl,"C:\Program Files\MATLAB\R2020a/extern/lib/win64/mingw64/mexFunction.def"
LINKEXPORTVER : -Wl,"C:\Program Files\MATLAB\R2020a/extern/lib/win64/mingw64/exportsmexfileversion.def"
LIBLOC : C:\Program Files\MATLAB\R2020a\extern\lib\win64\mingw64
LINKLIBS : -L"C:\Program Files\MATLAB\R2020a\extern\lib\win64\mingw64" -llibmx -llibmex -llibmat -lm -llibmwlapack -llibmwblas -llibMatlabDataArray -llibMatlabEngine
LDOPTIMFLAGS : -s
LDDEBUGFLAGS : -g
OBJEXT : .obj
LDEXT : .mexw64
SETENV : set COMPILER=C:\ProgramData\MATLAB\SupportPackages\R2020a\3P.instrset\mingw_w64.instrset\bin\gcc
set CXXCOMPILER=C:\ProgramData\MATLAB\SupportPackages\R2020a\3P.instrset\mingw_w64.instrset\bin\g++
set COMPFLAGS=-c -fexceptions -fno-omit-frame-pointer -DMATLAB_DEFAULT_RELEASE=R2017b -DUSE_MEX_CMD -m64 -DMATLAB_MEX_FILE -DMATLAB_MEX_FILE
set CXXCOMPFLAGS=-c -fexceptions -fno-omit-frame-pointer -std=c++11 -DMATLAB_DEFAULT_RELEASE=R2017b -DUSE_MEX_CMD -m64 -DMATLAB_MEX_FILE -DMATLAB_MEX_FILE
set OPTIMFLAGS=-O2 -fwrapv -DNDEBUG
set DEBUGFLAGS=-g
set LINKER=C:\ProgramData\MATLAB\SupportPackages\R2020a\3P.instrset\mingw_w64.instrset\bin\gcc
set CXXLINKER=C:\ProgramData\MATLAB\SupportPackages\R2020a\3P.instrset\mingw_w64.instrset\bin\g++
set LINKFLAGS=-m64 -Wl,--no-undefined -shared -static -L"C:\Program Files\MATLAB\R2020a\extern\lib\win64\mingw64" -llibmx -llibmex -llibmat -lm -llibmwlapack -llibmwblas -llibMatlabDataArray -llibMatlabEngine -Wl,"C:\Program Files\MATLAB\R2020a/extern/lib/win64/mingw64/mexFunction.def"
set LINKDEBUGFLAGS=-g
set NAME_OUTPUT= -o "%OUTDIR%%MEX_NAME%%MEX_EXT%"
MINGWROOT : C:\ProgramData\MATLAB\SupportPackages\R2020a\3P.instrset\mingw_w64.instrset
MINGWTARGET : x86_64-w64-mingw32
VERSION : 6.3.0
MATLABROOT : C:\Program Files\MATLAB\R2020a
ARCH : win64
SRC : "C:\Users\mlaub\Desktop\Promo_matlab\linked_grains_model2_readyCPP\codegen\mex\grain_struct_grower_para\grain_struct_grower_para.cpp";"C:\Users\mlaub\Desktop\Promo_matlab\linked_grains_model2_readyCPP\codegen\mex\grain_struct_grower_para\grain_struct_grower_para_mexutil.cpp";"C:\Users\mlaub\Desktop\Promo_matlab\linked_grains_model2_readyCPP\codegen\mex\grain_struct_grower_para\rt_nonfinite.cpp";"C:\Users\mlaub\Desktop\Promo_matlab\linked_grains_model2_readyCPP\codegen\mex\grain_struct_grower_para\_coder_grain_struct_grower_para_info.cpp";"C:\Users\mlaub\Desktop\Promo_matlab\linked_grains_model2_readyCPP\codegen\mex\grain_struct_grower_para\_coder_grain_struct_grower_para_mex.cpp";"C:\Program Files\MATLAB\R2020a\extern\version\cpp_mexapi_version.cpp"
OBJ : C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\grain_struct_grower_para.obj;C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\grain_struct_grower_para_mexutil.obj;C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\rt_nonfinite.obj;C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\_coder_grain_struct_grower_para_info.obj;C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\_coder_grain_struct_grower_para_mex.obj;C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\cpp_mexapi_version.obj
OBJS : C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\grain_struct_grower_para.obj C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\grain_struct_grower_para_mexutil.obj C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\rt_nonfinite.obj C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\_coder_grain_struct_grower_para_info.obj C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\_coder_grain_struct_grower_para_mex.obj C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\cpp_mexapi_version.obj
SRCROOT : C:\Users\mlaub\Desktop\Promo_matlab\linked_grains_model2_readyCPP\codegen\mex\grain_struct_grower_para\grain_struct_grower_para
DEF : C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\grain_struct_grower_para.def
EXP : "grain_struct_grower_para.exp"
LIB : "grain_struct_grower_para.lib"
EXE : grain_struct_grower_para.mexw64
ILK : "grain_struct_grower_para.ilk"
MANIFEST : "grain_struct_grower_para.mexw64.manifest"
TEMPNAME : grain_struct_grower_para
EXEDIR :
EXENAME : grain_struct_grower_para
OPTIM : -O2 -fwrapv -DNDEBUG
LINKOPTIM : -s
CMDLINE1_0 : C:\ProgramData\MATLAB\SupportPackages\R2020a\3P.instrset\mingw_w64.instrset\bin\g++ -c -DMATLAB_DEFAULT_RELEASE=R2017b -DUSE_MEX_CMD -m64 -DMATLAB_MEX_FILE -I"C:\Program Files\MATLAB\R2020a/extern/include" -I"C:\Program Files\MATLAB\R2020a/simulink/include" -fexceptions -fno-omit-frame-pointer -std=c++11 -O2 -fwrapv -DNDEBUG "C:\Users\mlaub\Desktop\Promo_matlab\linked_grains_model2_readyCPP\codegen\mex\grain_struct_grower_para\grain_struct_grower_para.cpp" -o C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\grain_struct_grower_para.obj
CMDLINE1_1 : C:\ProgramData\MATLAB\SupportPackages\R2020a\3P.instrset\mingw_w64.instrset\bin\g++ -c -DMATLAB_DEFAULT_RELEASE=R2017b -DUSE_MEX_CMD -m64 -DMATLAB_MEX_FILE -I"C:\Program Files\MATLAB\R2020a/extern/include" -I"C:\Program Files\MATLAB\R2020a/simulink/include" -fexceptions -fno-omit-frame-pointer -std=c++11 -O2 -fwrapv -DNDEBUG "C:\Users\mlaub\Desktop\Promo_matlab\linked_grains_model2_readyCPP\codegen\mex\grain_struct_grower_para\grain_struct_grower_para_mexutil.cpp" -o C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\grain_struct_grower_para_mexutil.obj
CMDLINE1_2 : C:\ProgramData\MATLAB\SupportPackages\R2020a\3P.instrset\mingw_w64.instrset\bin\g++ -c -DMATLAB_DEFAULT_RELEASE=R2017b -DUSE_MEX_CMD -m64 -DMATLAB_MEX_FILE -I"C:\Program Files\MATLAB\R2020a/extern/include" -I"C:\Program Files\MATLAB\R2020a/simulink/include" -fexceptions -fno-omit-frame-pointer -std=c++11 -O2 -fwrapv -DNDEBUG "C:\Users\mlaub\Desktop\Promo_matlab\linked_grains_model2_readyCPP\codegen\mex\grain_struct_grower_para\rt_nonfinite.cpp" -o C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\rt_nonfinite.obj
CMDLINE1_3 : C:\ProgramData\MATLAB\SupportPackages\R2020a\3P.instrset\mingw_w64.instrset\bin\g++ -c -DMATLAB_DEFAULT_RELEASE=R2017b -DUSE_MEX_CMD -m64 -DMATLAB_MEX_FILE -I"C:\Program Files\MATLAB\R2020a/extern/include" -I"C:\Program Files\MATLAB\R2020a/simulink/include" -fexceptions -fno-omit-frame-pointer -std=c++11 -O2 -fwrapv -DNDEBUG "C:\Users\mlaub\Desktop\Promo_matlab\linked_grains_model2_readyCPP\codegen\mex\grain_struct_grower_para\_coder_grain_struct_grower_para_info.cpp" -o C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\_coder_grain_struct_grower_para_info.obj
CMDLINE1_4 : C:\ProgramData\MATLAB\SupportPackages\R2020a\3P.instrset\mingw_w64.instrset\bin\g++ -c -DMATLAB_DEFAULT_RELEASE=R2017b -DUSE_MEX_CMD -m64 -DMATLAB_MEX_FILE -I"C:\Program Files\MATLAB\R2020a/extern/include" -I"C:\Program Files\MATLAB\R2020a/simulink/include" -fexceptions -fno-omit-frame-pointer -std=c++11 -O2 -fwrapv -DNDEBUG "C:\Users\mlaub\Desktop\Promo_matlab\linked_grains_model2_readyCPP\codegen\mex\grain_struct_grower_para\_coder_grain_struct_grower_para_mex.cpp" -o C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\_coder_grain_struct_grower_para_mex.obj
CMDLINE1_5 : C:\ProgramData\MATLAB\SupportPackages\R2020a\3P.instrset\mingw_w64.instrset\bin\g++ -c -DMATLAB_DEFAULT_RELEASE=R2017b -DUSE_MEX_CMD -m64 -DMATLAB_MEX_FILE -I"C:\Program Files\MATLAB\R2020a/extern/include" -I"C:\Program Files\MATLAB\R2020a/simulink/include" -fexceptions -fno-omit-frame-pointer -std=c++11 -O2 -fwrapv -DNDEBUG "C:\Program Files\MATLAB\R2020a\extern\version\cpp_mexapi_version.cpp" -o C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\cpp_mexapi_version.obj
-------------------------------------------------------------------
Building with 'MinGW64 Compiler (C++)'.
C:\ProgramData\MATLAB\SupportPackages\R2020a\3P.instrset\mingw_w64.instrset\bin\g++ -c -DMATLAB_DEFAULT_RELEASE=R2017b -DUSE_MEX_CMD -m64 -DMATLAB_MEX_FILE -I"C:\Program Files\MATLAB\R2020a/extern/include" -I"C:\Program Files\MATLAB\R2020a/simulink/include" -fexceptions -fno-omit-frame-pointer -std=c++11 -O2 -fwrapv -DNDEBUG "C:\Users\mlaub\Desktop\Promo_matlab\linked_grains_model2_readyCPP\codegen\mex\grain_struct_grower_para\grain_struct_grower_para.cpp" -o C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\grain_struct_grower_para.obj
C:\ProgramData\MATLAB\SupportPackages\R2020a\3P.instrset\mingw_w64.instrset\bin\g++ -c -DMATLAB_DEFAULT_RELEASE=R2017b -DUSE_MEX_CMD -m64 -DMATLAB_MEX_FILE -I"C:\Program Files\MATLAB\R2020a/extern/include" -I"C:\Program Files\MATLAB\R2020a/simulink/include" -fexceptions -fno-omit-frame-pointer -std=c++11 -O2 -fwrapv -DNDEBUG "C:\Users\mlaub\Desktop\Promo_matlab\linked_grains_model2_readyCPP\codegen\mex\grain_struct_grower_para\grain_struct_grower_para_mexutil.cpp" -o C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\grain_struct_grower_para_mexutil.obj
C:\ProgramData\MATLAB\SupportPackages\R2020a\3P.instrset\mingw_w64.instrset\bin\g++ -c -DMATLAB_DEFAULT_RELEASE=R2017b -DUSE_MEX_CMD -m64 -DMATLAB_MEX_FILE -I"C:\Program Files\MATLAB\R2020a/extern/include" -I"C:\Program Files\MATLAB\R2020a/simulink/include" -fexceptions -fno-omit-frame-pointer -std=c++11 -O2 -fwrapv -DNDEBUG "C:\Users\mlaub\Desktop\Promo_matlab\linked_grains_model2_readyCPP\codegen\mex\grain_struct_grower_para\rt_nonfinite.cpp" -o C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\rt_nonfinite.obj
C:\ProgramData\MATLAB\SupportPackages\R2020a\3P.instrset\mingw_w64.instrset\bin\g++ -c -DMATLAB_DEFAULT_RELEASE=R2017b -DUSE_MEX_CMD -m64 -DMATLAB_MEX_FILE -I"C:\Program Files\MATLAB\R2020a/extern/include" -I"C:\Program Files\MATLAB\R2020a/simulink/include" -fexceptions -fno-omit-frame-pointer -std=c++11 -O2 -fwrapv -DNDEBUG "C:\Users\mlaub\Desktop\Promo_matlab\linked_grains_model2_readyCPP\codegen\mex\grain_struct_grower_para\_coder_grain_struct_grower_para_info.cpp" -o C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\_coder_grain_struct_grower_para_info.obj
C:\ProgramData\MATLAB\SupportPackages\R2020a\3P.instrset\mingw_w64.instrset\bin\g++ -c -DMATLAB_DEFAULT_RELEASE=R2017b -DUSE_MEX_CMD -m64 -DMATLAB_MEX_FILE -I"C:\Program Files\MATLAB\R2020a/extern/include" -I"C:\Program Files\MATLAB\R2020a/simulink/include" -fexceptions -fno-omit-frame-pointer -std=c++11 -O2 -fwrapv -DNDEBUG "C:\Users\mlaub\Desktop\Promo_matlab\linked_grains_model2_readyCPP\codegen\mex\grain_struct_grower_para\_coder_grain_struct_grower_para_mex.cpp" -o C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\_coder_grain_struct_grower_para_mex.obj
C:\ProgramData\MATLAB\SupportPackages\R2020a\3P.instrset\mingw_w64.instrset\bin\g++ -c -DMATLAB_DEFAULT_RELEASE=R2017b -DUSE_MEX_CMD -m64 -DMATLAB_MEX_FILE -I"C:\Program Files\MATLAB\R2020a/extern/include" -I"C:\Program Files\MATLAB\R2020a/simulink/include" -fexceptions -fno-omit-frame-pointer -std=c++11 -O2 -fwrapv -DNDEBUG "C:\Program Files\MATLAB\R2020a\extern\version\cpp_mexapi_version.cpp" -o C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\cpp_mexapi_version.obj
C:\ProgramData\MATLAB\SupportPackages\R2020a\3P.instrset\mingw_w64.instrset\bin\g++ -m64 -Wl,--no-undefined -shared -static -s -Wl,"C:\Program Files\MATLAB\R2020a/extern/lib/win64/mingw64/exportsmexfileversion.def" C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\grain_struct_grower_para.obj C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\grain_struct_grower_para_mexutil.obj C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\rt_nonfinite.obj C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\_coder_grain_struct_grower_para_info.obj C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\_coder_grain_struct_grower_para_mex.obj C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\cpp_mexapi_version.obj -L"C:\Program Files\MATLAB\R2020a\extern\lib\win64\mingw64" -llibmx -llibmex -llibmat -lm -llibmwlapack -llibmwblas -llibMatlabDataArray -llibMatlabEngine -o grain_struct_grower_para.mexw64
Error using mex
C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\grain_struct_grower_para.obj:grain_struct_grower_para.cpp:(.text+0x29): undefined reference
to `emlrtAlias'
C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\grain_struct_grower_para.obj:grain_struct_grower_para.cpp:(.text+0x35): undefined reference
to `emlrtAlias'
C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\grain_struct_grower_para.obj:grain_struct_grower_para.cpp:(.text+0x6b): undefined reference
to `emlrtCheckBuiltInR2012b'
C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\grain_struct_grower_para.obj:grain_struct_grower_para.cpp:(.text+0x74): undefined reference
to `emlrtMxGetData'
C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\grain_struct_grower_para.obj:grain_struct_grower_para.cpp:(.text+0x80): undefined reference
to `emlrtDestroyArray'
C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\grain_struct_grower_para.obj:grain_struct_grower_para.cpp:(.text+0x89): undefined reference
to `emlrtDestroyArray'
C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\grain_struct_grower_para.obj:grain_struct_grower_para.cpp:(.text+0x92): undefined reference
to `emlrtDestroyArray'
C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\grain_struct_grower_para.obj:grain_struct_grower_para.cpp:(.text+0xd0): undefined reference
to `emlrtAlias'
C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\grain_struct_grower_para.obj:grain_struct_grower_para.cpp:(.text+0xdc): undefined reference
to `emlrtAlias'
C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\grain_struct_grower_para.obj:grain_struct_grower_para.cpp:(.text+0x112): undefined
reference to `emlrtCheckBuiltInR2012b'
C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\grain_struct_grower_para.obj:grain_struct_grower_para.cpp:(.text+0x11b): undefined
reference to `emlrtMxGetData'
C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\grain_struct_grower_para.obj:grain_struct_grower_para.cpp:(.text+0x128): undefined
reference to `emlrtDestroyArray'
C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\grain_struct_grower_para.obj:grain_struct_grower_para.cpp:(.text+0x131): undefined
reference to `emlrtDestroyArray'
C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\grain_struct_grower_para.obj:grain_struct_grower_para.cpp:(.text+0x13a): undefined
reference to `emlrtDestroyArray'
C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\grain_struct_grower_para.obj:grain_struct_grower_para.cpp:(.text+0x17b): undefined
reference to `emlrtCreateNumericArray'
C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\grain_struct_grower_para.obj:grain_struct_grower_para.cpp:(.text+0x189): undefined
reference to `emlrtMxSetData'
C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\grain_struct_grower_para.obj:grain_struct_grower_para.cpp:(.text+0x19e): undefined
reference to `emlrtSetDimensions'
C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\grain_struct_grower_para.obj:grain_struct_grower_para.cpp:(.text+0x1aa): undefined
reference to `emlrtAssign'
C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\grain_struct_grower_para.obj:grain_struct_grower_para.cpp:(.text+0x288): undefined
reference to `omp_in_parallel'
C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\grain_struct_grower_para.obj:grain_struct_grower_para.cpp:(.text+0x297): undefined
reference to `emlrtEnterParallelRegion'
C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\grain_struct_grower_para.obj:grain_struct_grower_para.cpp:(.text+0x2a7): undefined
reference to `omp_get_thread_num'
C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\grain_struct_grower_para.obj:grain_struct_grower_para.cpp:(.text+0x2b5): undefined
reference to `emlrtAllocTLS'
C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\grain_struct_grower_para.obj:grain_struct_grower_para.cpp:(.text+0x48f): undefined
reference to `emlrtHeapReferenceStackEnterFcnR2012b'
C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\grain_struct_grower_para.obj:grain_struct_grower_para.cpp:(.text+0x514): undefined
reference to `emlrtSizeMulR2012b'
C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\grain_struct_grower_para.obj:grain_struct_grower_para.cpp:(.text+0x52a): undefined
reference to `emlrtSizeMulR2012b'
C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\grain_struct_grower_para.obj:grain_struct_grower_para.cpp:(.text+0x567): undefined
reference to `emlrtMallocMex'
C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\grain_struct_grower_para.obj:grain_struct_grower_para.cpp:(.text+0x5a0): undefined
reference to `emlrtMallocMex'
C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\grain_struct_grower_para.obj:grain_struct_grower_para.cpp:(.text+0x5b9): undefined
reference to `emlrtFreeMex'
C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\grain_struct_grower_para.obj:grain_struct_grower_para.cpp:(.text+0x66b): undefined
reference to `muDoubleScalarIsNaN'
C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\grain_struct_grower_para.obj:grain_struct_grower_para.cpp:(.text+0x679): undefined
reference to `muDoubleScalarIsNaN'
C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\grain_struct_grower_para.obj:grain_struct_grower_para.cpp:(.text+0x724): undefined
reference to `muDoubleScalarPower'
C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\grain_struct_grower_para.obj:grain_struct_grower_para.cpp:(.text+0x788): undefined
reference to `emlrtDynamicBoundsCheckR2012b'
C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\grain_struct_grower_para.obj:grain_struct_grower_para.cpp:(.text+0x819): undefined
reference to `emlrtSubAssignSizeCheck1dR2017a'
C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\grain_struct_grower_para.obj:grain_struct_grower_para.cpp:(.text+0x88e): undefined
reference to `emlrtDynamicBoundsCheckR2012b'
C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\grain_struct_grower_para.obj:grain_struct_grower_para.cpp:(.text+0x92b): undefined
reference to `emlrtDynamicBoundsCheckR2012b'
C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\grain_struct_grower_para.obj:grain_struct_grower_para.cpp:(.text+0xa86): undefined
reference to `muDoubleScalarAbs'
C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\grain_struct_grower_para.obj:grain_struct_grower_para.cpp:(.text+0xb2a): undefined
reference to `emlrtDynamicBoundsCheckR2012b'
C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\grain_struct_grower_para.obj:grain_struct_grower_para.cpp:(.text+0xb76): undefined
reference to `muDoubleScalarAbs'
C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\grain_struct_grower_para.obj:grain_struct_grower_para.cpp:(.text+0xbe2): undefined
reference to `emlrtDynamicBoundsCheckR2012b'
C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\grain_struct_grower_para.obj:grain_struct_grower_para.cpp:(.text+0xc2f): undefined
reference to `emlrtSizeEqCheck1DR2012b'
C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\grain_struct_grower_para.obj:grain_struct_grower_para.cpp:(.text+0xcbc): undefined
reference to `emlrtDynamicBoundsCheckR2012b'
C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\grain_struct_grower_para.obj:grain_struct_grower_para.cpp:(.text+0xd03): undefined
reference to `muDoubleScalarAbs'
C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\grain_struct_grower_para.obj:grain_struct_grower_para.cpp:(.text+0xd75): undefined
reference to `emlrtDynamicBoundsCheckR2012b'
C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\grain_struct_grower_para.obj:grain_struct_grower_para.cpp:(.text+0xdc1): undefined
reference to `emlrtSizeEqCheck1DR2012b'
C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\grain_struct_grower_para.obj:grain_struct_grower_para.cpp:(.text+0xefe): undefined
reference to `emlrtDynamicBoundsCheckR2012b'
C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\grain_struct_grower_para.obj:grain_struct_grower_para.cpp:(.text+0xf43): undefined
reference to `muDoubleScalarAbs'
C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\grain_struct_grower_para.obj:grain_struct_grower_para.cpp:(.text+0x1120): undefined
reference to `emlrtDynamicBoundsCheckR2012b'
C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\grain_struct_grower_para.obj:grain_struct_grower_para.cpp:(.text+0x1163): undefined
reference to `muDoubleScalarAbs'
C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\grain_struct_grower_para.obj:grain_struct_grower_para.cpp:(.text+0x1242): undefined
reference to `emlrtSizeEqCheck1DR2012b'
C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\grain_struct_grower_para.obj:grain_struct_grower_para.cpp:(.text+0x129f): undefined
reference to `emlrtSubAssignSizeCheck1dR2017a'
C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\grain_struct_grower_para.obj:grain_struct_grower_para.cpp:(.text+0x12f1): undefined
reference to `emlrtDynamicBoundsCheckR2012b'
C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\grain_struct_grower_para.obj:grain_struct_grower_para.cpp:(.text+0x13ff): undefined
reference to `emlrtSizeMulR2012b'
C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\grain_struct_grower_para.obj:grain_struct_grower_para.cpp:(.text+0x1415): undefined
reference to `emlrtSizeMulR2012b'
C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\grain_struct_grower_para.obj:grain_struct_grower_para.cpp:(.text+0x146c): undefined
reference to `emlrtMallocMex'
C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\grain_struct_grower_para.obj:grain_struct_grower_para.cpp:(.text+0x156b): undefined
reference to `muDoubleScalarIsNaN'
C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\grain_struct_grower_para.obj:grain_struct_grower_para.cpp:(.text+0x1579): undefined
reference to `muDoubleScalarIsNaN'
C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\grain_struct_grower_para.obj:grain_struct_grower_para.cpp:(.text+0x168b): undefined
reference to `emlrtDynamicBoundsCheckR2012b'
C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\grain_struct_grower_para.obj:grain_struct_grower_para.cpp:(.text+0x176a): undefined
reference to `emlrtDynamicBoundsCheckR2012b'
C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\grain_struct_grower_para.obj:grain_struct_grower_para.cpp:(.text+0x17cc): undefined
reference to `emlrtHeapReferenceStackLeaveFcnR2012b'
C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\grain_struct_grower_para.obj:grain_struct_grower_para.cpp:(.text+0x17e6): undefined
reference to `emlrtFreeMex'
C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\grain_struct_grower_para.obj:grain_struct_grower_para.cpp:(.text+0x1896): undefined
reference to `emlrtErrorWithMessageIdR2018a'
C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\grain_struct_grower_para.obj:grain_struct_grower_para.cpp:(.text+0x18a4): undefined
reference to `emlrtBreakCheckR2012b'
C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\grain_struct_grower_para.obj:grain_struct_grower_para.cpp:(.text+0x18b2): undefined
reference to `omp_in_parallel'
C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\grain_struct_grower_para.obj:grain_struct_grower_para.cpp:(.text+0x18c8): undefined
reference to `emlrtExitParallelRegion'
C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\grain_struct_grower_para.obj:grain_struct_grower_para.cpp:(.text+0x18d8): undefined
reference to `muDoubleScalarIsNaN'
C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\grain_struct_grower_para.obj:grain_struct_grower_para.cpp:(.text+0x1947): undefined
reference to `muDoubleScalarIsNaN'
C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\grain_struct_grower_para.obj:grain_struct_grower_para.cpp:(.text+0x1a5c): undefined
reference to `emlrtErrorWithMessageIdR2018a'
C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\grain_struct_grower_para.obj:grain_struct_grower_para.cpp:(.text+0x1a71): undefined
reference to `emlrtMallocMex'
C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\grain_struct_grower_para.obj:grain_struct_grower_para.cpp:(.text+0x1afd): undefined
reference to `emlrtFreeMex'
C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\grain_struct_grower_para.obj:grain_struct_grower_para.cpp:(.text+0x1b32): undefined
reference to `muDoubleScalarPower'
C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\grain_struct_grower_para.obj:grain_struct_grower_para.cpp:(.text+0x1b6a): undefined
reference to `emlrtFreeMex'
C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\grain_struct_grower_para.obj:grain_struct_grower_para.cpp:(.text+0x1c3b): undefined
reference to `emlrtHeapAllocationErrorR2012b'
C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\grain_struct_grower_para.obj:grain_struct_grower_para.cpp:(.text+0x1c65): undefined
reference to `emlrtHeapAllocationErrorR2012b'
C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\grain_struct_grower_para.obj:grain_struct_grower_para.cpp:(.text+0x1c7a): undefined
reference to `emlrtHeapAllocationErrorR2012b'
C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\grain_struct_grower_para.obj:grain_struct_grower_para.cpp:(.text+0x1c8f): undefined
reference to `emlrtHeapAllocationErrorR2012b'
C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\grain_struct_grower_para.obj:grain_struct_grower_para.cpp:(.text+0x1dfe): undefined
reference to `emlrtFreeMex'
C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\grain_struct_grower_para.obj:grain_struct_grower_para.cpp:(.text+0x1f83): undefined
reference to `emlrtAlias'
C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\grain_struct_grower_para.obj:grain_struct_grower_para.cpp:(.text+0x1fa2): undefined
reference to `emlrtAlias'
C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\grain_struct_grower_para.obj:grain_struct_grower_para.cpp:(.text+0x1fc1): undefined
reference to `emlrtAlias'
C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\grain_struct_grower_para.obj:grain_struct_grower_para.cpp:(.text+0x1fe0): undefined
reference to `emlrtAliasP'
C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\grain_struct_grower_para.obj:grain_struct_grower_para.cpp:(.text+0x1fff): undefined
reference to `emlrtAliasP'
C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\grain_struct_grower_para.obj:grain_struct_grower_para.cpp:(.text+0x201e): undefined
reference to `emlrtAliasP'
C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\grain_struct_grower_para.obj:grain_struct_grower_para.cpp:(.text+0x203e): undefined
reference to `emlrtAliasP'
C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\grain_struct_grower_para.obj:grain_struct_grower_para.cpp:(.text+0x205e): undefined
reference to `emlrtAliasP'
C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\grain_struct_grower_para.obj:grain_struct_grower_para.cpp:(.text+0x207e): more undefined
references to `emlrtAliasP' follow
C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\grain_struct_grower_para.obj:grain_struct_grower_para.cpp:(.text+0x209e): undefined
reference to `emlrtAlias'
C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\grain_struct_grower_para.obj:grain_struct_grower_para.cpp:(.text+0x20ca): undefined
reference to `emlrtAlias'
C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\grain_struct_grower_para.obj:grain_struct_grower_para.cpp:(.text+0x20d6): undefined
reference to `emlrtAlias'
C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\grain_struct_grower_para.obj:grain_struct_grower_para.cpp:(.text+0x210f): undefined
reference to `emlrtCheckBuiltInR2012b'
C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\grain_struct_grower_para.obj:grain_struct_grower_para.cpp:(.text+0x2118): undefined
reference to `emlrtMxGetData'
C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\grain_struct_grower_para.obj:grain_struct_grower_para.cpp:(.text+0x2125): undefined
reference to `emlrtDestroyArray'
C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\grain_struct_grower_para.obj:grain_struct_grower_para.cpp:(.text+0x212e): undefined
reference to `emlrtDestroyArray'
C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\grain_struct_grower_para.obj:grain_struct_grower_para.cpp:(.text+0x2137): undefined
reference to `emlrtDestroyArray'
C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\grain_struct_grower_para.obj:grain_struct_grower_para.cpp:(.text+0x2140): undefined
reference to `emlrtAliasP'
C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\grain_struct_grower_para.obj:grain_struct_grower_para.cpp:(.text+0x2160): undefined
reference to `emlrtAliasP'
C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\grain_struct_grower_para.obj:grain_struct_grower_para.cpp:(.text+0x2180): undefined
reference to `emlrtAliasP'
C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\grain_struct_grower_para.obj:grain_struct_grower_para.cpp:(.text+0x21a0): undefined
reference to `emlrtAliasP'
C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\grain_struct_grower_para.obj:grain_struct_grower_para.cpp:(.text+0x233e): undefined
reference to `emlrtEnterRtStackR2012b'
C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\grain_struct_grower_para.obj:grain_struct_grower_para.cpp:(.text+0x2346): undefined
reference to `emlrtLeaveRtStackR2012b'
C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\grain_struct_grower_para.obj:grain_struct_grower_para.cpp:(.text+0x2352): undefined
reference to `emlrtDestroyRootTLS'
C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\grain_struct_grower_para.obj:grain_struct_grower_para.cpp:(.text+0x235e): undefined
reference to `emlrtExitTimeCleanup'
C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\grain_struct_grower_para.obj:grain_struct_grower_para.cpp:(.text+0x23a6): undefined
reference to `emlrtGetBreakCheckFlagAddressR2012b'
C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\grain_struct_grower_para.obj:grain_struct_grower_para.cpp:(.text+0x23c8): undefined
reference to `emlrtClearAllocCountR2012b'
C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\grain_struct_grower_para.obj:grain_struct_grower_para.cpp:(.text+0x23d0): undefined
reference to `emlrtEnterRtStackR2012b'
C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\grain_struct_grower_para.obj:grain_struct_grower_para.cpp:(.text+0x23dc): undefined
reference to `emlrtFirstTimeR2012b'
C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\grain_struct_grower_para.obj:grain_struct_grower_para.cpp:(.text+0x23e1): undefined
reference to `omp_in_parallel'
C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\grain_struct_grower_para.obj:grain_struct_grower_para.cpp:(.text+0x23ec): undefined
reference to `emlrtEnterParallelRegion'
C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\grain_struct_grower_para.obj:grain_struct_grower_para.cpp:(.text+0x23f1): undefined
reference to `omp_in_parallel'
C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\grain_struct_grower_para.obj:grain_struct_grower_para.cpp:(.text+0x23fc): undefined
reference to `emlrtEnterParallelRegion'
C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\grain_struct_grower_para.obj:grain_struct_grower_para.cpp:(.text+0x2417): undefined
reference to `omp_get_max_threads'
C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\grain_struct_grower_para.obj:grain_struct_grower_para.cpp:(.text+0x2420): undefined
reference to `omp_in_parallel'
C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\grain_struct_grower_para.obj:grain_struct_grower_para.cpp:(.text+0x242b): undefined
reference to `emlrtExitParallelRegion'
C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\grain_struct_grower_para.obj:grain_struct_grower_para.cpp:(.text+0x2430): undefined
reference to `omp_in_parallel'
C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\grain_struct_grower_para.obj:grain_struct_grower_para.cpp:(.text+0x243b): undefined
reference to `emlrtExitParallelRegion'
C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\grain_struct_grower_para.obj:grain_struct_grower_para.cpp:(.text+0x247f): undefined
reference to `omp_in_parallel'
C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\grain_struct_grower_para.obj:grain_struct_grower_para.cpp:(.text+0x248a): undefined
reference to `emlrtEnterParallelRegion'
C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\grain_struct_grower_para.obj:grain_struct_grower_para.cpp:(.text+0x248f): undefined
reference to `omp_in_parallel'
C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\grain_struct_grower_para.obj:grain_struct_grower_para.cpp:(.text+0x249a): undefined
reference to `emlrtEnterParallelRegion'
C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\grain_struct_grower_para.obj:grain_struct_grower_para.cpp:(.text+0x24b0): undefined
reference to `omp_get_max_threads'
C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\grain_struct_grower_para.obj:grain_struct_grower_para.cpp:(.text+0x24b9): undefined
reference to `omp_in_parallel'
C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\grain_struct_grower_para.obj:grain_struct_grower_para.cpp:(.text+0x24c4): undefined
reference to `emlrtExitParallelRegion'
C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\grain_struct_grower_para.obj:grain_struct_grower_para.cpp:(.text+0x24c9): undefined
reference to `omp_in_parallel'
C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\grain_struct_grower_para.obj:grain_struct_grower_para.cpp:(.text+0x24d4): undefined
reference to `emlrtExitParallelRegion'
C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\grain_struct_grower_para.obj:grain_struct_grower_para.cpp:(.text+0x24dc): undefined
reference to `emlrtLeaveRtStackR2012b'
C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\grain_struct_grower_para.obj:grain_struct_grower_para.cpp:(.text+0x24e8): undefined
reference to `emlrtDestroyRootTLS'
C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\grain_struct_grower_para_mexutil.obj:grain_struct_grower_para_mexutil.cpp:(.text+0x31):
undefined reference to `omp_set_lock'
C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\grain_struct_grower_para_mexutil.obj:grain_struct_grower_para_mexutil.cpp:(.text+0x4d):
undefined reference to `omp_unset_lock'
C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\_coder_grain_struct_grower_para_info.obj:_coder_grain_struct_grower_para_info.cpp:(.text+0xa6):
undefined reference to `emlrtCreateStructMatrix'
C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\_coder_grain_struct_grower_para_info.obj:_coder_grain_struct_grower_para_info.cpp:(.text+0xb8):
undefined reference to `emlrtCreateLogicalMatrix'
C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\_coder_grain_struct_grower_para_info.obj:_coder_grain_struct_grower_para_info.cpp:(.text+0xc8):
undefined reference to `emlrtMxCreateString'
C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\_coder_grain_struct_grower_para_info.obj:_coder_grain_struct_grower_para_info.cpp:(.text+0xdc):
undefined reference to `emlrtSetField'
C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\_coder_grain_struct_grower_para_info.obj:_coder_grain_struct_grower_para_info.cpp:(.text+0xe9):
undefined reference to `emlrtMxCreateDoubleScalar'
C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\_coder_grain_struct_grower_para_info.obj:_coder_grain_struct_grower_para_info.cpp:(.text+0xfd):
undefined reference to `emlrtSetField'
C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\_coder_grain_struct_grower_para_info.obj:_coder_grain_struct_grower_para_info.cpp:(.text+0x10a):
undefined reference to `emlrtMxCreateDoubleScalar'
C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\_coder_grain_struct_grower_para_info.obj:_coder_grain_struct_grower_para_info.cpp:(.text+0x11a):
undefined reference to `emlrtSetField'
C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\_coder_grain_struct_grower_para_info.obj:_coder_grain_struct_grower_para_info.cpp:(.text+0x12b):
undefined reference to `emlrtSetField'
C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\_coder_grain_struct_grower_para_info.obj:_coder_grain_struct_grower_para_info.cpp:(.text+0x137):
undefined reference to `emlrtMxCreateString'
C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\_coder_grain_struct_grower_para_info.obj:_coder_grain_struct_grower_para_info.cpp:(.text+0x147):
undefined reference to `emlrtSetField'
C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\_coder_grain_struct_grower_para_info.obj:_coder_grain_struct_grower_para_info.cpp:(.text+0x154):
undefined reference to `emlrtMxCreateDoubleScalar'
C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\_coder_grain_struct_grower_para_info.obj:_coder_grain_struct_grower_para_info.cpp:(.text+0x164):
undefined reference to `emlrtSetField'
C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\_coder_grain_struct_grower_para_info.obj:_coder_grain_struct_grower_para_info.cpp:(.text+0x17d):
undefined reference to `emlrtCreateStructMatrix'
C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\_coder_grain_struct_grower_para_info.obj:_coder_grain_struct_grower_para_info.cpp:(.text+0x18c):
undefined reference to `emlrtMxCreateString'
C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\_coder_grain_struct_grower_para_info.obj:_coder_grain_struct_grower_para_info.cpp:(.text+0x19c):
undefined reference to `emlrtSetField'
C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\_coder_grain_struct_grower_para_info.obj:_coder_grain_struct_grower_para_info.cpp:(.text+0x1ce):
undefined reference to `emlrtNameCaptureMxArrayR2016a'
C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\_coder_grain_struct_grower_para_info.obj:_coder_grain_struct_grower_para_info.cpp:(.text+0x1df):
undefined reference to `emlrtSetField'
C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\_coder_grain_struct_grower_para_info.obj:_coder_grain_struct_grower_para_info.cpp:(.text+0x1f3):
undefined reference to `emlrtSetField'
C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\_coder_grain_struct_grower_para_mex.obj:_coder_grain_struct_grower_para_mex.cpp:(.text+0x78):
undefined reference to `emlrtErrMsgIdAndTxt'
C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\_coder_grain_struct_grower_para_mex.obj:_coder_grain_struct_grower_para_mex.cpp:(.text+0xa5):
undefined reference to `emlrtReturnArrays'
C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\_coder_grain_struct_grower_para_mex.obj:_coder_grain_struct_grower_para_mex.cpp:(.text+0xec):
undefined reference to `emlrtErrMsgIdAndTxt'
C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\_coder_grain_struct_grower_para_mex.obj:_coder_grain_struct_grower_para_mex.cpp:(.text+0x153):
undefined reference to `emlrtLoadLibrary'
C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\_coder_grain_struct_grower_para_mex.obj:_coder_grain_struct_grower_para_mex.cpp:(.text+0x15f):
undefined reference to `omp_init_lock'
C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\_coder_grain_struct_grower_para_mex.obj:_coder_grain_struct_grower_para_mex.cpp:(.text+0x16b):
undefined reference to `omp_init_nest_lock'
C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\_coder_grain_struct_grower_para_mex.obj:_coder_grain_struct_grower_para_mex.cpp:(.text+0x1a1):
undefined reference to `omp_destroy_lock'
C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\_coder_grain_struct_grower_para_mex.obj:_coder_grain_struct_grower_para_mex.cpp:(.text+0x1ad):
undefined reference to `omp_destroy_nest_lock'
C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\_coder_grain_struct_grower_para_mex.obj:_coder_grain_struct_grower_para_mex.cpp:(.text+0x1ca):
undefined reference to `omp_destroy_lock'
C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\_coder_grain_struct_grower_para_mex.obj:_coder_grain_struct_grower_para_mex.cpp:(.text+0x1d6):
undefined reference to `omp_destroy_nest_lock'
C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\_coder_grain_struct_grower_para_mex.obj:_coder_grain_struct_grower_para_mex.cpp:(.text+0x1df):
undefined reference to `emlrtReportParallelRunTimeError'
C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\_coder_grain_struct_grower_para_mex.obj:_coder_grain_struct_grower_para_mex.cpp:(.text+0x209):
undefined reference to `omp_get_num_procs'
C:\Users\mlaub\AppData\Local\Temp\mex_2843770821395138_3468\_coder_grain_struct_grower_para_mex.obj:_coder_grain_struct_grower_para_mex.cpp:(.text+0x226):
undefined reference to `emlrtCreateRootTLS'
collect2.exe: error: ld returned 1 exit status
I dont get why emlrtAlias and many other cand be found, the folder extern/include where this header is, is named in the path at the top. I can even copy the emlrt.h into the directory where the cpp's are and it still says the same error.
exist('...\emlrt.h', 'file')=2, so the file is there...
Whats the problem?
gregory pais
gregory pais 2022-6-7
编辑:gregory pais 2022-6-7
mex compiler indicates you that functions emlrt are not found. To solve it you have to indicate to the linker where these functions are present. These functions are present in libemlrt.lib under matlabroot\extern\lib\mingw64. You have to add the library file to the mex command like this mex -v *.cpp '-llibemlrt'.
Probably you have to add libmwmathutil where muDouble functions like muDoubleScalarMin are defined.
mex -v *.cpp '-llibemlrt' '-llibmwmathutil'

请先登录,再进行评论。

更多回答(0 个)

Community Treasure Hunt

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

Start Hunting!

Translated by