undefined reference
AnsweredHi
I am having a problem when trying to use the Gurobi library in C++. Specifically, I am getting "undefined reference" errors during the linking process. I have added the necessary lines to my bashrc and am compiling my test file with the command
g++ test.cpp -o main -I../../../../software/gurobi1000/linux64/include -L../../../../software/gurobi1000/linux64/lib
I have attempted to research the issue, and have come across the following link by Gurobi support:
https://support.gurobi.com/hc/en-us/articles/360039093112-How-do-I-resolve-undefined-reference-errors-while-linking-Gurobi-in-C-.
I have verified that the libgurobi_c++.a
file is present in the lib directory, however, the issue remains unresolved.
I would appreciate any help in resolving this issue.
-
Hi Samira,
It looks like you have to recompile the library: How do I resolve "undefined reference" errors while linking Gurobi in C++?
Cheers,
David0 -
Also, it seems that you have forgotten to import the library. Just add \(\texttt{-lgurobi100 -lgurobi_c++}\).
Cheers,
David0 -
I have been able to successfully compile utilizing:
g++ test.cpp -o main -I../../../../software/gurobi1000/linux64/include -L../../../../software/gurobi1000/linux64/lib -lgurobi100 -lgurobi_c++
Thanks!0
Please sign in to leave a comment.
Comments
3 comments