Gurobi doesn't compile with C++ on linux

1,340 views
Skip to first unread message

Giuseppe Paolo

unread,
Apr 14, 2016, 1:28:30 PM4/14/16
to Gurobi Optimization

Hi,
I am a student that is using Gurobi with an academic licence for a project.
I installed Gurobi and managed to make it work with MATLAB, but now I have to use it with my C++ code and even if I include gurobi_c++.h, libgurobi_c++.a, libgurobi65.so it doesn't work. I also tried to run one of the example outside its folder it doesn't work; at the same time if I run it in the gurobi folder it goes smoothly.
I built the Makefile in the src folder but still when I try to compile the code I get a lot of errors like this:

libgurobi_c++.a:6:1: error: stray ‘\311’ in program

I'm running Linux Ubuntu 14.04 on a 64bit machine with Gurobi 6.5.1.
There is something that I am missing?
Thanks for help,
Giuseppe

Greg Glockner

unread,
Apr 14, 2016, 1:34:14 PM4/14/16
to gur...@googlegroups.com
Does the Makefile work for you in the examples subdirectory?

Giuseppe Paolo

unread,
Apr 14, 2016, 7:34:13 PM4/14/16
to Gurobi Optimization
Yes, the one in the example/build folder works without any problem.
In my file I also tried to include the whole path of gurobi_c++.h but tells me that GRBenv doesn't exist, while if I include the whole path of the other 2 libraries I get an infinite amount of errors

Giuseppe Paolo

unread,
Apr 14, 2016, 7:34:19 PM4/14/16
to Gurobi Optimization
Ok, now also the examples stopped working.
I'll try to reinstall everything from scratch again and see what happens.


On Thursday, April 14, 2016 at 7:34:14 PM UTC+2, Greg Glockner wrote:

Giuseppe Paolo

unread,
Apr 14, 2016, 7:51:26 PM4/14/16
to Gurobi Optimization
Reinstalled but still not able to compile any cpp file. All the makefiles work, but when I try to compile the cpp file it says that gurobi_c++.h is not found

Giuseppe Paolo

unread,
Apr 15, 2016, 6:31:56 AM4/15/16
to Gurobi Optimization
UPDATE:
I reinstalled Gurobi with the following steps
1) decompress it in the folder I wanted
2) set the global variables:
export GUROBI_HOME="/home/giuseppe/Documents/gurobi651/linux64"
export PATH="${PATH}:${GUROBI_HOME}/bin"
export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${GUROBI_HOME}/lib"
export CPLUS_INCLUDE_PATH="${CPLUS_INCLUDE_PATH}:${GUROBI_HOME}/include"

3) execute the make file in the src/build folder.

but still when I compile it doesn't link to the libraries. Is there something that I am missing? Cause I managed to make it work with MATLAB and through terminal but if I try to compile the c++ files it doesn't work.
Please help me

Greg Glockner

unread,
Apr 15, 2016, 9:38:47 AM4/15/16
to gur...@googlegroups.com
What Linux distribution and what version of gcc/g++/glibc?


Giuseppe Paolo

unread,
Apr 15, 2016, 9:40:56 AM4/15/16
to Gurobi Optimization
Ubuntu 14.04
gcc is 4.8.4 but I also tried with 4.4 and got the same problems

Greg Glockner

unread,
Apr 15, 2016, 9:56:10 AM4/15/16
to gur...@googlegroups.com
> Ubuntu 14.04
> gcc is 4.8.4 but I also tried with 4.4 and got the same problems

Thanks. It definitely works with a standard Ubuntu 14.04 installation. We use that extensively ourselves.

You should test the C examples just to make sure there isn't something else wrong with your system. If that works, you could try compiling the C++ interface yourself -- the source is now included in the src subdirectory of GUROBI_HOME.

Giuseppe Paolo

unread,
Apr 15, 2016, 10:25:21 AM4/15/16
to Gurobi Optimization
Ok, managed to solve the problem.
In the makefile if I use the standard LD_LIBRARY_PATH it doesn't work, so had to define a library path only for gurobi and now it compiles.
Thanks a lot for the help :)

Francesco Bertoli

unread,
Nov 30, 2016, 6:54:47 PM11/30/16
to Gurobi Optimization
HI Giuseppe. I'm having the same problem and I don't know much about CMakeList, could you post what you wrote in the CMakeList file eventually please?
Reply all
Reply to author
Forward
0 new messages