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

10 ビュー (過去 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.

カテゴリ

Help Center および File ExchangeC Shared Library Integration についてさらに検索

製品


リリース

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by