I can use standalone c++ codes with Gurobi on my linux machine.
I am trying to use Gurobi in a project which uses CUDA and has some .cu files
However all the Gurobi code is in .cpp file and I am compiling using the flags I use for my standalone codes.
The command is:
g++ -I/opt/gurobi912/linux64/include/ -I/usr/local/cuda/include -L/opt/gurobi912/linux64/lib -lgurobi_c++ -lgurobi91 -c helper.cpp -o ../o/helper.o
(helper.cpp) is the file with a function that uses Gurobi.
I get an error during compilation with undefined reference to every Gurobi class object.
helper.cpp:(.text+0x1ec): undefined reference to `GRBEnv::GRBEnv(bool)'
helper.cpp:(.text+0x20c): undefined reference to `GRBModel::GRBModel(GRBEnv const&)'
helper.cpp:(.text+0x258): undefined reference to `GRBVar::GRBVar()'
helper.cpp:(.text+0x2b5): undefined reference to `GRBVar::GRBVar()'
and so on..
Please help, the error seems to occur only when I have cuda APIs somewhere in my code.
Please sign in to leave a comment.