How do I resolve the undefined reference error in libgurobi_c++.a?
Awaiting user inputI try to use gurobi with cmake. I have already get the correct PATH in the compile procedure, however I get the undefined reference in a very simple case. the simple case is your eample qp_c++.cpp.
The error log is show as follows:
/home/haoyizhang/gurobi1001/linux64/lib/libgurobi_c++.a(Env.o): In function `GRBEnv::~GRBEnv()':
Env.cpp:(.text+0x24): undefined reference to `GRBfreeenv'
/home/haoyizhang/gurobi1001/linux64/lib/libgurobi_c++.a(Env.o): In function `GRBEnv::message(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)':
Env.cpp:(.text+0x39): undefined reference to `GRBmsg'
/home/haoyizhang/gurobi1001/linux64/lib/libgurobi_c++.a(Env.o): In function `GRBEnv::getErrorMsg[abi:cxx11]() const':
Env.cpp:(.text+0x4a): undefined reference to `GRBgeterrormsg'
/home/haoyizhang/gurobi1001/linux64/lib/libgurobi_c++.a(Env.o): In function `GRBEnv::start()':
Env.cpp:(.text+0xaf): undefined reference to `GRBstartenv'
/home/haoyizhang/gurobi1001/linux64/lib/libgurobi_c++.a(Env.o): In function `GRBEnv::fixTuneParam(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)':
Env.cpp:(.text+0x176): undefined reference to `GRBfixtuneparam'
/home/haoyizhang/gurobi1001/linux64/lib/libgurobi_c++.a(Env.o): In function `GRBEnv::get(GRB_IntParam) const':
Env.cpp:(.text+0x24e): undefined reference to `GRBgetintparam'
/home/haoyizhang/gurobi1001/linux64/lib/libgurobi_c++.a(Env.o): In function `GRBEnv::get(GRB_DoubleParam) const':
Env.cpp:(.text+0x330): undefined reference to `GRBgetdblparam'
/home/haoyizhang/gurobi1001/linux64/lib/libgurobi_c++.a(Env.o): In function `GRBEnv::set(GRB_IntParam, int)':
Env.cpp:(.text+0x40f): undefined reference to `GRBsetintparam'
/home/haoyizhang/gurobi1001/linux64/lib/libgurobi_c++.a(Env.o): In function `GRBEnv::set(GRB_DoubleParam, double)':
Env.cpp:(.text+0x4e1): undefined reference to `GRBsetdblparam'
/home/haoyizhang/gurobi1001/linux64/lib/libgurobi_c++.a(Env.o): In function `GRBEnv::set(GRB_StringParam, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)':
0
-
Official comment
This post is more than two years old. Some information may not be up to date. For current information, please check the Gurobi Documentation or Knowledge Base. If you need more help, please create a new post in the community forum, or try Gurobot, our chatbot interface offering instant, expert-level support. -
Hi,
Have you tried the steps in our article: How do I resolve "undefined reference" errors while linking Gurobi in C++?Cheers,
David0
Post is closed for comments.
Comments
2 comments