News:

When registered with our forums, feel free to send a "here I am" post here to differ human beings from SPAM bots.

Main Menu

Gurobi in Code::Blocks

Started by Lobric, October 15, 2020, 05:15:50 PM

Previous topic - Next topic

Lobric

Hi !
I've tried to include "gurobi_c++.h" in but unluckily failed.
Can anyone tell me which part did I do wrong?





I did this both in the compiler setting and the project build options.

Result:


I'll appreciate it very much.

Miguel Gimenez


sodev

Looking at the names of the link libraries it looks like you added pretty much every Visual Studio compiled variant that was supplied, that won't work. You need to use the one library that matches your compiler. Most probably you are using some GCC compiler, it looks like all the libraries in your list are for Visual Studio, the last one might be a pure C library while the others might be C++ libraries, or it might be a GCC one. But this is just pure crystal ball science.

The proper solution is to figure out which compiler you use and if the library vendor offers a library for that compiler and what it's name is.

Lobric

Thanks for your replies.

Sorry, I just added all the libraries and failed.
I didn't know it doesn't provide support for MinGW.
It seems like the reason why it's always undefined.

This is from Gurobi's website.


Is that means I can't use Gurobi with Code Block ?

Miguel Gimenez

Code::Blocks is an IDE, not a compiler, and you can change the compiler it uses; MinGW is just a convenient and free option.

If the library you want to use only supports Visual Studio you can install this M$ crapware (https://visualstudio.microsoft.com/es/vs/community/) and select it as compiler in your C::B project or just use their IDE.

nenin

Quote from: Lobric on October 15, 2020, 08:25:44 PM
Thanks for your replies.

Sorry, I just added all the libraries and failed.
I didn't know it doesn't provide support for MinGW.
*****

Is that means I can't use Gurobi with Code Block ?
Theoretically if Gurobi  supplis dlls, you can try to link dlls, not libs, directly to you project. GCC can do it. But even in case of the successful linking there may be a lot of the other issues for c++ library.

MortenMacFly

Quote from: Lobric on October 15, 2020, 08:25:44 PM
I didn't know it doesn't provide support for MinGW.
I can tell that I use Gurobi with MinGW just fine. Not being shown on the hompage as a supported IDE does not mean anything. If the compiler you use supports the MS library format (assuming you don't mix languages not supported), the libs can be used with this compiler, too. MinGW is quite compatible. I never had major issues with using MSVC libs. Just as a hint: Its easier to configure in C::B if you make a copy of the library with a *.a instead of *.lib extension.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: [url="https://www.codeblocks.org/docs/main_codeblocks_en.html"]https://www.codeblocks.org/docs/main_codeblocks_en.html[/url]
C::B FAQ: [url="https://wiki.codeblocks.org/index.php?title=FAQ"]https://wiki.codeblocks.org/index.php?title=FAQ[/url]