How to compile Gurobi C++ interface in Mac OS X 10.8.5 with latest Xcode

1,146 views
Skip to first unread message

Shayan

unread,
Oct 15, 2013, 4:02:40 AM10/15/13
to gur...@googlegroups.com
Hi everyone,

I tried to compile my C++ Gurobi code which was compiled in my old computer but when I tried to compile it in my new mac book it does not. It seems that Gurobi does not work with C++11. I wonder if there is any solution for it? How can I compile with old C++ compiler?

Thanks.


Greg Glockner

unread,
Oct 15, 2013, 10:56:29 AM10/15/13
to gur...@googlegroups.com
C++ 11 is not supported.

Shayan

unread,
Oct 15, 2013, 1:28:57 PM10/15/13
to gur...@googlegroups.com
Yeah I know. I'm just asking if there is a way to use a older C++ version in Mac OS 10.8.5 to compile Gurobi?

Jakob Sch.

unread,
Oct 15, 2013, 4:01:26 PM10/15/13
to gur...@googlegroups.com
Hi Shayan,

can you post the error message that you get? You said the code compiled on your old system, which specs did it have?

Best regards,
Jakob

Greg Glockner

unread,
Oct 15, 2013, 4:08:18 PM10/15/13
to gur...@googlegroups.com

Shayan

unread,
Oct 15, 2013, 4:35:43 PM10/15/13
to gur...@googlegroups.com
Hi Jacob,

For instance when I try to compile one of the examples from Gurobi website: "diet_c++.cpp" I get the following errors:


Undefined symbols for architecture x86_64:
  "GRBLinExpr::GRBLinExpr(double)", referenced from:
      _main in cchQaGYg.o
  "GRBLinExpr::operator+=(GRBLinExpr const&)", referenced from:
      _main in cchQaGYg.o
  "GRBQuadExpr::GRBQuadExpr(GRBLinExpr)", referenced from:
      _main in cchQaGYg.o
  "GRBQuadExpr::GRBQuadExpr(GRBVar, double)", referenced from:
      _main in cchQaGYg.o
  "GRBQuadExpr::GRBQuadExpr(double)", referenced from:
      _main in cchQaGYg.o
  "GRBEnv::GRBEnv()", referenced from:
      _main in cchQaGYg.o
  "GRBEnv::~GRBEnv()", referenced from:
      _main in cchQaGYg.o
  "GRBModel::set(GRB_IntAttr, int)", referenced from:
      _main in cchQaGYg.o
  "GRBModel::set(GRB_StringAttr, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)", referenced from:
      _main in cchQaGYg.o
  "GRBModel::update()", referenced from:
      _main in cchQaGYg.o
  "GRBModel::addVars(double const*, double const*, double const*, char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const*, int)", referenced from:
      _main in cchQaGYg.o
  "GRBModel::optimize()", referenced from:
      _main in cchQaGYg.o
  "GRBModel::addConstr(GRBTempConstr const&, std::basic_string<char, std::char_traits<char>, std::allocator<char> >)", referenced from:
      _main in cchQaGYg.o
  "GRBModel::GRBModel(GRBEnv const&)", referenced from:
      _main in cchQaGYg.o
  "GRBModel::~GRBModel()", referenced from:
      _main in cchQaGYg.o
  "GRBException::getMessage() const", referenced from:
      _main in cchQaGYg.o
  "GRBException::getErrorCode() const", referenced from:
      _main in cchQaGYg.o
  "GRBVar::get(GRB_DoubleAttr) const", referenced from:
      printSolution(GRBModel&, int, int, GRBVar*, GRBVar*)in cchQaGYg.o
  "GRBVar::get(GRB_StringAttr) const", referenced from:
      printSolution(GRBModel&, int, int, GRBVar*, GRBVar*)in cchQaGYg.o
  "GRBModel::get(GRB_IntAttr) const", referenced from:
      printSolution(GRBModel&, int, int, GRBVar*, GRBVar*)in cchQaGYg.o
  "GRBModel::get(GRB_DoubleAttr) const", referenced from:
      printSolution(GRBModel&, int, int, GRBVar*, GRBVar*)in cchQaGYg.o
  "operator==(GRBQuadExpr, GRBQuadExpr)", referenced from:
      _main in cchQaGYg.o
  "operator<=(GRBQuadExpr, GRBQuadExpr)", referenced from:
      _main in cchQaGYg.o
  "operator*(double, GRBVar)", referenced from:
      _main in cchQaGYg.o
  "operator+(GRBVar, GRBVar)", referenced from:
      _main in cchQaGYg.o
ld: symbol(s) not found for architecture x86_64

I use terminal with following command:

g++ diet_c++.cpp 

Thanks.

Greg Glockner

unread,
Oct 15, 2013, 4:41:57 PM10/15/13
to gur...@googlegroups.com
This is a linker error. Look at the Makefile in the examples/build subdirectory.

Shayan

unread,
Oct 15, 2013, 5:00:15 PM10/15/13
to gur...@googlegroups.com
Yeah it worked. Thanks a lot.
Reply all
Reply to author
Forward
0 new messages