Building and running the example

To build and run the example, we refer the user to the files in <installdir>/examples/build. The <installdir>/examples/build directory contains an example Makefile. Typing make mip1_c++ will build and run this example.

If you want to create your own project or makefile to build a C++ program that calls Gurobi, the details will depend on your platform and development environment, but we'd like to point out a few common pitfalls:

  • A C++ program that uses Gurobi must link in both the Gurobi C++ library libgurobi_c++.a and the Gurobi C library
  • The Gurobi Linux distribution includes multiple C++ libraries. You may need to choose an alternate version (e.g., libgurobi_g++5.2.a), depending on the version of g++ you are using. You should consult the supported platform list for additional information.

The C++ example directory <installdir>/examples/c++ contains a number of examples. We encourage you to browse and modify them in order to become more familiar with the Gurobi C++ interface. We also encourage you to read the Gurobi Example Tour for more information.