Empty error message with GRBgeterrormsg
AnsweredI'm using the GUROBI 9.1.2 C API on Ubuntu 18.04 with gcc 7.5.0. Following the example, the following lines are supposed to print an error message (when error happens):
if (error) {
printf("ERROR: %s\n", GRBgeterrormsg(env));
exit(1);
}
But in the log file the error message is empty.
Best objective 2.560000000000e+02, best bound -, gap -
ERROR:
Command exited with non-zero status 1
I could print out the error code instead. Just wondering if I'm using the GRBgeterrormsg wrong.
-
Official comment
This post is more than three 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 why not try our AI Gurobot?. -
Interesting!
It could be that there is no error message for this error or that you are querying the message after it's not available anymore. Is the error block directly following the call that produces the error?
Best regards,
Matthias1 -
Thank you Matthias, your comment made me realize my funny mistake. In the examples, the model and environment are freed after the if(error) block. I must have thought "it's better to clean everything up before exit(1)", and moved those two lines before the if block, without noticing that GRBgeterrormsg still needs the environment.
How do I close this question? Or maybe even delete it (since it doesn't provide much value for other users)?
0 -
Great to hear that you could resolve the issue!
We usually don't delete questions because most likely you are not the first or the only person that ran into this issue - or will run into it in the future.
We will just mark the question as "Answered".
Cheers,
Matthias1
Post is closed for comments.
Comments
4 comments