We want to make the C++ API compatible with as many different compilers and compiler versions as possible. For that reason, we provide source files for the API so you can build the library yourself using your compiler of choice.
While building a C++ application that uses Gurobi, If the linking process causes "undefined reference" errors like these
undefined reference to `GRBModel::addVar(double, double, double, char, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)'
undefined reference to `GRBModel::addConstr(GRBTempConstr const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)'
undefined reference to `GRBVar::get[abi:cxx11](GRB_StringAttr) const'
you should recompile the C++ API library and replace the old one to resolve any ABI incompatibilities. On Linux, this can be done from the system command prompt with the following (changing the directory to match your Gurobi version):
cd /opt/gurobi1200/linux64/src/build
make
cp libgurobi_c++.a ../../lib/
For macOS, please use the respective path to the build directory by replacing linux64
with macos_universal2
.
Comments
0 comments
Article is closed for comments.