通过命令行在 Mac 上编译 Cplex 程序

Compiling a Cplex program on Mac via command line

我有一个使用 CPLEX 的 MIP 模型。我是编译 Mac 中程序的新手。我想知道编译此类程序的命令行是什么?我已经在我的机器上安装了 CPLEX。 这是我正在使用的命令,但它不起作用:

g++ -I/<'path'>/CPLEX_Studio1261/cplex/include -I/<'path'>/CPLEX_Studio1261/concert/include -L/<'path'>/CPLEX_Studio1261/cplex/lib/x86-64_linux/static_pic -L/<'path'>/CPLEX_Studio1261/concert/lib/x86-64_linux/static_pic hello.cpp -lilocplex -lconcert -lcplex

感谢任何帮助!

我自己没有使用过 CPLEX,但您似乎在以下方面犯了错误:

8.1 add *.h and *.lib path in the "searching path" and "library path"
8.2 add -DIL_STL "in other c flags"
8.3 add -lilocplex -lconcert -lcplex in "other linker flags"

我认为您也需要将源文件的名称 (hello.cpp) 放在命令行上的所有 linker 内容之前。

参见 link - here