How to: compile C++ with Gurobi in Linux

In order to compile your C++ project with Gurobi, you first need to create the appropriate libgurobi_c++.a compatible with your g++ version. To do so, access the following directory and compile it:

cd [GRB_path]/linux64/src/build
make
The file is now created, so copy it to the lib folder:
cp libgurobi_c++.a ../../lib/
Now you can create your makefile. For example:
CCC = g++ 
FLAGS = -g -Wall -Wextra 
GRBPATH = /[full path to]/gurobi752/ 

exec: code.cpp 
     $(CCC) $(FLAGS) code.cpp -o exec -I$(GRBPATH)/linux64/include -L$(GRBPATH)/linux64/lib -lgurobi_c++ -lgurobi75 

clean: 
     rm -f code *.o *~

You might need to change spaces to tabs in the above makefile.

This was useful? Buy me a cup of coffee to help me keep this website running!



How to: Install MS Visual Studio Express and create a C++ project (Windows)

In this tutorial I will describe how to install Microsoft Visual Studio Express 2012.

Start by downloading MS Visual Studio Express 2012 for free from MS Visual Studio Express 2012. Install the downloaded file as shown in the picture below.

installing VS2012E

Continue reading How to: Install MS Visual Studio Express and create a C++ project (Windows)