Compiling error with Matlab 2019b - Error using mbuild (line 166)
4 views (last 30 days)
Show older comments
Hello!
I’m having some issues when I try to compile a DLL in Matlab 2019b. I use the Library Compiler to create a DLL of a Matlab function, and then I create a wrapper and DLL using the mbuild command. I have recently been using Matlab 2014a, and I can use the following line without issue to create the DLL and wrappercode:
mbuild -v -g wtest.c test.lib LINKFLAGS="$LINKFLAGS /DLL " LDEXT=".dll" CMDLINE250="mt -outputresource:$EXE';'2 -manifest $MANIFEST";
However, if I use the same code in Matlab 2019b (I have compiled the Matlab function with the 2019b Library Compiler), I get the following error:
Error using mbuild (line 166)
Unable to complete successfully.
C:/MingGW/bin/../lib/gcc/x86_64-w64-mingw32/6.3.0/../../../../x86_64-w64-mingw32/lib/../lib/libmingw32.a(lib64_libmingw32_a-crt0_c.o):crt0_c.c:(.text.startup+0x2e):
undefined reference to `WinMain'
collect2.exe: error: ld returned 1 exit status
In Matlab 2014a the DLL is built using 'Microsoft Windows SDK 7.1', while the Matlab 2019b uses 'MinGW64 Compiler'.
I’ve had some troubles installing MinGW64 extension as I have Matlab on an offline computer, and I suspect this could be some of the issue. I've tried to reinstall it and still have the same issue.
Do you have any advice?
2 Comments
Answers (1)
Sunil Patidar
on 9 Mar 2021
Hi,
Try using any of the supported Microsoft Visual C compiler mentioned in the list in the link below and see if you are able to generate the DLL wrapper
Once you have installed the compiler you can use the "mbuild -setup" command to change the compiler that MATLAB will use.
0 Comments
See Also
Categories
Find more on MATLAB Support for MinGW-w64 C/C++ Compiler in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!