Errors compiling mex file with c++ and mysql in R2016b

7 ビュー (過去 30 日間)
Marina Frants
Marina Frants 2021 年 9 月 24 日
回答済み: Swatantra Mahato 2021 年 10 月 7 日
I've been given some Matlab code for R2016b and a .cpp file to go with it, and I'm trying to compile it on Windows10 with the MinGW64 C++ compiler. My mex command is:
mex('<my script>', '-v', ['-I' inclib], ['-L' linklib], '-lmysqlclient')
Where inclib='C:\Program Files\MySQL\MySQL Server 8.0\include' and linklib='C:\Program Files\MySQL\MySQL Server 8.0\lib'
This starts of with a bunch of warnings:
Warning: corrupt .drectve at end of def file
followed by a huge dump of error messages:
C:\Program Files\MySQL\MySQL Server 8.0\lib/mysqlclient.lib(C:/build/sb_1-3692420-1625128314.67/release/libmysql/clientlib_objlib.dir/RelWithDebInfo/client_plugin.obj):(.text$mn+0x175): undefined reference to __security_check_cookie' C:\Program Files\MySQL\MySQL Server 8.0\lib/mysqlclient.lib(C:/build/sb_1-3692420-1625128314.67/release/libmysql/clientlib_objlib.dir/RelWithDebInfo/client_plugin.obj):(.text$mn+0x1cf): undefined reference to __security_check_cookie' C:\Program Files\MySQL\MySQL Server 8.0\lib/mysqlclient.lib(C:/build/sb_1-3692420-1625128314.67/release/libmysql/clientlib_objlib.dir/RelWithDebInfo/client_plugin.obj):(.text$mn+0x3c2): undefined reference to __security_check_cookie' C:\Program Files\MySQL\MySQL Server 8.0\lib/mysqlclient.lib(C:/build/sb_1-3692420-1625128314.67/release/libmysql/clientlib_objlib.dir/RelWithDebInfo/client_plugin.obj):(.xdata[$unwind$mysql_load_plugin_v]+0x14): undefined reference to __GSHandlerCheck' C:\Program Files\MySQL\MySQL Server 8.0\lib/mysqlclient.lib(C:/build/sb_1-3692420-1625128314.67/release/libmysql/clientlib_objlib.dir/RelWithDebInfo/client_plugin.obj):(.xdata[$unwind$mysql_client_plugin_init]+0x8): undefined reference to __GSHandlerCheck'
And so on and so forth, with these errors being repeated over and over
Are there some libraries that I'm missings, or settings I need to change? I'm new to both Windows and C++, so I'm not really sure where to start.

回答 (1 件)

Swatantra Mahato
Swatantra Mahato 2021 年 10 月 7 日
Hi Marina,
From my understanding of the initial warning and the following error messages, this looks like an issue caused by using the "MinGW" compiler to compile files which require libraries from the "Microsoft Visual C++" compiler.
You may want to switch the C++ compiler to an appropriate version of MSVC for R2016b to link the required libraries correctly. You can find the list of supported compilers from the below link
Hope this helps

カテゴリ

Help Center および File ExchangeWrite C Functions Callable from MATLAB (MEX Files) についてさらに検索

製品


リリース

R2016b

Community Treasure Hunt

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

Start Hunting!

Translated by