Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. Qt Creator and Gurobi
Qt 6.11 is out! See what's new in the release blog

Qt Creator and Gurobi

Scheduled Pinned Locked Moved Qt Creator and other tools
6 Posts 3 Posters 4.8k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • ? Offline
    ? Offline
    A Former User
    wrote on last edited by
    #1

    Hi,

    I'm a beginner in Qt and currently writing codes in Qt Creator 2.2.1 (Qt 4.7.1) to solve an math optimization model by using Gurobi C++ libraries. After installing Gurobi, I got several library files as follow:

    gurobi46.lib - Gurobi library import file
    gurobi_c++md2008.lib - C++ interface (when using -MD compiler switch with Visual Studio 2008)
    gurobi_c++md2010.lib - C++ interface (when using -MD compiler switch with Visual Studio 2010)
    gurobi_c++mdd2008.lib - C++ interface (when using -MDd compiler switch with Visual Studio 2008)
    gurobi_c++mdd2010.lib - C++ interface (when using -MDd compiler switch with Visual Studio 2010)
    gurobi_c++mt2008.lib - C++ interface (when using -MT compiler switch with Visual Studio 2008)
    gurobi_c++mt2010.lib - C++ interface (when using -MT compiler switch with Visual Studio 2010)
    gurobi_c++mtd2008.lib - C++ interface (when using -MTd compiler switch with Visual Studio 2008)
    gurobi_c++mtd2010.lib - C++ interface (when using -MTd compiler switch with Visual Studio 2010)

    Also, there are two Include files in a "include" folder. I did add the folder's path in .pro file under INCLUDEPATH section.

    Then, I tried to create a simple program that only declares a Gurobi variable, but it does not work.
    @
    #include <QtCore/QCoreApplication>
    #include "gurobi_c++.h"

    int main(int argc, char *argv[])
    {
    QCoreApplication a(argc, argv);
    GRBenv env = GRBenv();
    return a.exec();
    }
    @

    There is an error saying that "Variable 'GRBenv env' has initializer but incomplete type"
    So, I guess I might forget to include the library in the .pro file so I add it as an external library by using the "Add Library...." in the right-click menu. The problem is that I don't know which one I should add so I try each one of them, one by one, but none of them works. The error is still there.

    I don't know what kind of things or steps I missed. Could any one help, please?

    PS: the Gurobi library I downloaded from the website is for Window64. There is another one for Linux-32. I did download it and have several .a and .so files. However, the creator could not see them when I tried to add them.

    [Edit: Wrapped code in @ tags. Be sure to use them! mlong]

    1 Reply Last reply
    0
    • ? Offline
      ? Offline
      A Former User
      wrote on last edited by
      #2

      Did you check the qmake docs on "Declaring Other Libraries":/doc/qt-4.8/qmake-project-files.html#declaring-other-libraries already? Basically, you will have to adjust the INCLUDEPATH and LIBS variables.

      1 Reply Last reply
      0
      • ? Offline
        ? Offline
        A Former User
        wrote on last edited by
        #3

        Thanks, Volker for the reply! I did try the method in your link and now there is a new error (but I guess a better one). It said

        LNK1104: Cannot open file gurobi_c++md2010.lib

        It seems that the compiler found the library but cannot open it???
        I also tried to use other library files but they all gave me the same error message.

        1 Reply Last reply
        0
        • V Offline
          V Offline
          VanDerSam
          wrote on last edited by
          #4

          Сheck the your library path in LIBS variable.

          1 Reply Last reply
          0
          • ? Offline
            ? Offline
            A Former User
            wrote on last edited by
            #5

            What did you add to your .pro file?

            1 Reply Last reply
            0
            • ? Offline
              ? Offline
              A Former User
              wrote on last edited by
              #6

              Oh sorry guys for this very late reply. I found out that I tried to use 64-bit library with 32-bit compiler. Such a shame :D haha Thank you all very much for the replies. I do appreciate your help.

              1 Reply Last reply
              0

              • Login

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Users
              • Groups
              • Search
              • Get Qt Extensions
              • Unsolved