我正在尝试在MATLAB中编译Mex文件this example,该文件使用C语言中的CPLEX API来解决线性编程问题。不幸的是,我收到了这个错误:
mex - I/..../Applications/IBM/ILOG/CPLEX_Studio1271/cplex/include/ilcplex -
L/...../Applications/IBM/ILOG/CPLEX_Studio1271/cplex/lib/x86-
64_osx/static_pic -lcplex lp_cplex_mex.c
Building with 'Xcode with Clang'.
/..../Desktop/example/lp_cplex_mex.c:142:9: warning: implicit
declaration of function 'CPXopenCPLEXdevelop' is invalid in C99 [-
Wimplicit-function-declaration]
env = CPXopenCPLEXdevelop(&status);
^
/....../Desktop/example/lp_cplex_mex.c:142:7: warning: incompatible
integer to pointer conversion assigning to 'CPXENVptr' (aka 'struct
cpxenv *') from 'int' [-Wint-conversion] env =
CPXopenCPLEXdevelop(&status);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/......./Desktop/example/lp_cplex_mex.c:209:20: warning: implicit
declaration of function 'CPXgetitc' is invalid in C99 [-Wimplicit-
function-declaration] *itcnt = (double)CPXgetitc(env,lp);
^
3 warnings generated.
Error using mex
Undefined symbols for architecture x86_64:
"_CPXgetitc", referenced from:
_mexFunction in lp_cplex_mex.o
(maybe you meant: _CPXgetitcnt)
"_CPXopenCPLEXdevelop", referenced from:
_mexFunction in lp_cplex_mex.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see
invocation)
一些基本信息:
我可以编译yprime.c和其他不使用CPLEX的MEX文件 API
我在Mac OSX El Capitan 10.11.16上使用MATLAB 2015a
我正在使用XCode 8.2中包含的GCC包
我想我的问题是库,它可以找到文件夹但内部有问题,有.../cplex/lib/x86-64_osx/static_pic
文件的内容:
我认为我们应该有.so
扩展名的文件,我非常感谢大家提出的任何建议。