connecting CPLEX to Qt



  • hello, i'm new in Qt, i don't know how to use CPLEX libraries in Qt
    so here is my *.pro file

    QT += core
    QT -= gui
    
    CONFIG += c++11
    
    TARGET = Console1
    
    CONFIG += console
    CONFIG -= app_bundle
    
    TEMPLATE = app
    
    SOURCES += main.cpp
    
    QMAKE_CFLAGS_RELEASE = -O2 -MD -MP -C -Wall -fPIC
    
    INCLUDEPATH += C:/IBM/ILOG/CPLEX_Studio_Preview126/cplex/include
    INCLUDEPATH += C:/IBM/ILOG/CPLEX_Studio_Preview126/concert/include
    INCLUDEPATH += C:/Program Files (x86)/Microsoft Visual Studio 11.0/VC/include
    
    
    DEFINES += IL_STD, ILO_MSVC, ILO_RS6000, _USING_V110_SDK71_
    
    
    #// cplex123.lib library
    LIBS += C:/IBM/ILOG/CPLEX_Studio_Preview126/cplex/lib/x86_windows_vs2012/stat_mda/cplex1260.lib
    
    #// ilocplex library
    LIBS += C:/IBM/ILOG/CPLEX_Studio_Preview126/cplex/lib/x86_windows_vs2012/stat_mda/ilocplex.lib
    
    #// concert.lib library
    LIBS += C:/IBM/ILOG/CPLEX_Studio_Preview126/concert/lib/x86_windows_vs2012/stat_mda/concert.lib
    
    

    i'm using MSVC 2013 kit, compiling with visual c++ 11.0 but actually this doesn't work, i've got those errors :

    C:\IBM\ILOG\CPLEX_Studio_Preview126\cplex\include\ilcplex\cpxconst.h:288: error: expected ')' before 'deprecated'
     #      define CPXDEPRECATEDAPI(version) __declspec(dllimport deprecated)
                                                                  ^
    

    someone can help me ?


  • Qt Champions 2018

    It doesn't look like a Qt issue. You should check whether this library supports your compiler.



  • cplex libraries are created to visual c++ (2012 here) and i've set the compiler as Microsoft Visual C++ compiler 11.0 (x86)


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    You can't mix libraries built with different versions of Visual Studio. Their compiler are not compatible one with the other. All libraries and applications must be build with the same version of Visual Studio.



  • @SGaist Hi thank you for answering
    what can i do now ? i've tested it on visual C++ 2013 and i set the platforme at v110 beause of libraries for visual C++ 2012 and it works fine
    but i don't know how to do for Qt


  • Lifetime Qt Champion

    Do you have that library available for any other version of Visual Studio ?



  • @SGaist yes, for visual studio 2010


  • Lifetime Qt Champion

    Nothing more modern ?

    In any case, you can build Qt yourself from sources using the latest version of Visual Studio you can to accommodate that library.



  • i have only libraries for visual studio 2012 and 2010, how can i do it ?


  • Lifetime Qt Champion

    Here you have the instructions