0

I'm trying to Compile a Mex file, this example, in MATLAB that uses the CPLEX API in C to solve linear programming problems. Unfortunately, I get this error :

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)

Some basic information:

  • I can compile yprime.c and other MEX files that do not use the CPLEX API

  • I am using MATLAB 2015a on Mac OSX El Capitan 10.11.16

  • I am using the GCC package included in XCode 8.2

I guess my problem is with library, it can find the folder but something wrong inside, There is the content of .../cplex/lib/x86-64_osx/static_pic file:

  • libilocplex.a
  • libcplexdistmip.a
  • libcplex.a

I think we should have files with .so extension, I would greatly appreciate any advice people may have.

Na Freeman
  • 33
  • 1
  • 1
  • 9

0 Answers0