Code::Blocks Forums
User forums => General (but related to Code::Blocks) => Topic started by: Lobric on October 15, 2020, 05:15:50 pm
-
Hi !
I’ve tried to include "gurobi_c++.h" in but unluckily failed.
Can anyone tell me which part did I do wrong?
(https://i.imgur.com/ahBclZv.png)
(https://i.imgur.com/4PIKgZX.png)
(https://i.imgur.com/tFpFPRd.png)
I did this both in the compiler setting and the project build options.
Result:
(https://i.imgur.com/LulmX6x.png)
I’ll appreciate it very much.
-
This is a linker problem, gurobi_c++.h was included successfully. Post a full rebuild log in code tags, see http://wiki.codeblocks.org/index.php?title=FAQ-Compiling_%28general%29#Q:_How_do_I_report_a_compilation_problem_on_the_forums.3F (http://wiki.codeblocks.org/index.php?title=FAQ-Compiling_%28general%29#Q:_How_do_I_report_a_compilation_problem_on_the_forums.3F)
-
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.
-
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.
(https://i.imgur.com/rMbHJs5.png)
Is that means I can't use Gurobi with Code Block ?
-
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/ (https://visualstudio.microsoft.com/es/vs/community/)) and select it as compiler in your C::B project or just use their IDE.
-
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.
-
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.