Compiling error with Matlab 2019b - Error using mbuild (line 166)

조회 수: 3 (최근 30일)
Kristoffer Lied
Kristoffer Lied 2019년 12월 3일
답변: Sunil Patidar 2021년 3월 9일
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
Jack Frank
Jack Frank 2020년 2월 26일
I have the same issue, have you resolved this problem?
Frank
Kristoffer Lied
Kristoffer Lied 2020년 4월 3일
Hello! Sorry for the late reply.
No, I have not resolved the problem.
Kristoffer

댓글을 달려면 로그인하십시오.

답변 (1개)

Sunil Patidar
Sunil Patidar 2021년 3월 9일
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.

제품


릴리스

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by