【发布时间】:2016-02-25 22:21:44
【问题描述】:
(注意:详细信息已更新。) 我正在尝试在我的机器上安装 mYm(运行 OS X 10.11.3 的 MacBook Pro 15")。下载了 mYm,我尝试使用Matlab中的墨西哥:
> mex -I/usr/local/mysql/include -L/usr/local/mysql/lib mym.cpp;
但是,我收到以下我无法解决的错误:
Building with 'Xcode Clang++'.
Error using mex
Undefined symbols for architecture x86_64:
"_compress", referenced from:
_mexFunction in mym.o
"_compressBound", referenced from:
_mexFunction in mym.o
"_mysql_affected_rows", referenced from:
_mexFunction in mym.o
"_mysql_close", referenced from:
_mexFunction in mym.o
"_mysql_data_seek", referenced from:
_mexFunction in mym.o
"_mysql_error", referenced from:
_mexFunction in mym.o
"_mysql_fetch_fields", referenced from:
_mexFunction in mym.o
"_mysql_fetch_lengths", referenced from:
_mexFunction in mym.o
"_mysql_fetch_row", referenced from:
_mexFunction in mym.o
"_mysql_field_count", referenced from:
_mexFunction in mym.o
"_mysql_free_result", referenced from:
_mexFunction in mym.o
"_mysql_get_client_info", referenced from:
_mexFunction in mym.o
"_mysql_get_host_info", referenced from:
_mexFunction in mym.o
"_mysql_get_server_info", referenced from:
_mexFunction in mym.o
"_mysql_init", referenced from:
_mexFunction in mym.o
"_mysql_num_fields", referenced from:
_mexFunction in mym.o
"_mysql_num_rows", referenced from:
_mexFunction in mym.o
"_mysql_ping", referenced from:
_mexFunction in mym.o
"_mysql_query", referenced from:
_mexFunction in mym.o
"_mysql_real_connect", referenced from:
_mexFunction in mym.o
"_mysql_real_escape_string", referenced from:
_mexFunction in mym.o
"_mysql_real_query", referenced from:
_mexFunction in mym.o
"_mysql_select_db", referenced from:
_mexFunction in mym.o
"_mysql_stat", referenced from:
_mexFunction in mym.o
"_mysql_store_result", referenced from:
_mexFunction in mym.o
"_uncompress", referenced from:
deserialize(char const*, unsigned long) in mym.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
谁能帮忙?安装指南告诉我还要包含 zlib 包含和 lib 文件,但我不知道它们在哪里?我已经安装了 XCode。
顺便说一句:
>> mex -setup
MEX configured to use 'Xcode with Clang' for C language compilation.
【问题讨论】:
-
上面的代码有两个错误:首先你需要 static_cast
(length) 因为你的编译器没有从 long 到 int 的隐式转换。第二个你需要在 mym.cpp 中#include 。最后,我认为在 C++ 模式下编译 mex 代码没有多大意义,除非你知道如何在 mex 环境中使用 C++ 对象,我假设你还不知道。 -
谢谢,到目前为止。我修复了一些编译错误。请立即检查更新的错误。
-
您缺少很多库。找到库并使用 -l 和 -L 将它们传递给 mex
-
你有使用 mYm 的经验吗?这是我刚刚下载的一个库,我不知道要查找哪些库。会不会是
zlib不见了? -
我不知道。你很可能在你包含的头文件中找到这些函数,并且从头文件中你知道它们属于哪个库。