Decision Optimization

Decision Optimization

Delivers prescriptive analytics capabilities and decision intelligence to improve decision-making.


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  undefined reference to `_imp__CPXopenCPLEX@4'

    Posted 12/09/10 05:30 AM

    Originally posted by: mkmk


    Hi,

    I am trying to implement quadratic programming into c++ by calling callable library (not c++ library)

    I am using window 7 and MinGW for complier. (using eclipse for editing & running)

    In the environmen variables, User variable PATH is well defined (i think)

    C:\MinGW32\bin;C:\ILOG\CPLEX_Studio_AcademicResearch122\opl\bin\x86_win32;C:\ILOG\CPLEX_Studio_AcademicResearch122\opl\oplide\;C:\ILOG\CPLEX_Studio_AcademicResearch122\cplex\bin\x86_win32;C:\ILOG\CPLEX_Studio_AcademicResearch122\cpoptimizer\bin\x86_win32;

    People are saying it might be linking problem.. but i have no idea what else I have to do.

    Please Please give me some advice.
    #CPLEXOptimizers
    #DecisionOptimization


  • 2.  Re: undefined reference to `_imp__CPXopenCPLEX@4'

    Posted 12/09/10 07:50 AM

    Originally posted by: Laci Ladanyi


    To link with the ILOG C++ libraries on windows you have to use the visual studio compiler as that is what was used to compile those libraries, and at the C++ level cl (the Visual Studio compiler) and g++ are not binary compatible.

    --Laci
    #CPLEXOptimizers
    #DecisionOptimization


  • 3.  Re: undefined reference to `_imp__CPXopenCPLEX@4'

    Posted 12/09/10 08:19 AM

    Originally posted by: SystemAdmin


    But he only wants to link to the C library, not the C++ library, right? Shouldn't this work also with g++? Note that we have the required 'extern "C" { ... }' in the cplex.h header file.

    Tobias
    #CPLEXOptimizers
    #DecisionOptimization


  • 4.  Re: undefined reference to `_imp__CPXopenCPLEX@4'

    Posted 12/09/10 08:35 AM

    Originally posted by: Laci Ladanyi


    Uh-oh, you are right. I misread the sentence "I am trying to implement quadratic programming into c++ by calling callable library (not c++ library)". :-(

    --Laci
    #CPLEXOptimizers
    #DecisionOptimization


  • 5.  Re: undefined reference to `_imp__CPXopenCPLEX@4'

    Posted 12/09/10 09:05 AM

    Originally posted by: mkmk


    In the source code, I included #include <cplex.h>.

    Also in MinGW32/include folder, I copied cplex.h there..

    it is still giving me the same error...

    Anyone who has solved this problem before??
    #CPLEXOptimizers
    #DecisionOptimization


  • 6.  Re: undefined reference to `_imp__CPXopenCPLEX@4'

    Posted 12/09/10 09:09 AM

    Originally posted by: SystemAdmin


    Hm, not sure if this is supported at all. Anyway,
    • What is the content of C:\ILOG\CPLEX_Studio_AcademicResearch122\cplex\bin\x86_win32 on your installation?
    • Are you sure that MinGW looks through the PATH variable when looking for libraries when linking? I don't know. It might be looking at other environment variables.
    • What is the exact linking command you use?

    #CPLEXOptimizers
    #DecisionOptimization


  • 7.  Re: undefined reference to `_imp__CPXopenCPLEX@4'

    Posted 12/09/10 09:17 AM

    Originally posted by: mkmk


    • What is the content of C:\ILOG\CPLEX_Studio_AcademicResearch122\cplex\bin\x86_win32 on your installation?

    In x86_win32 folder, there are
    -convert (application)
    -cplex (application)
    -cplex122.dll (application extension)
    -cplexamp (application
    -CplexPlugIn.dll (application extension)
    -CplexPlugIn (XML Document)
    -ILOG.Concert.dll (application extension)
    -ILOG.CONCERT (XML Document)
    -ILOG.CPLEX.dll (application extension)
    -ILOG.CPLEX (XML Document)

    * Are you sure that MinGW looks through the PATH variable when looking for libraries when linking? I don't know. It might be looking at other environment variables.

    * What is the exact linking command you use?

    I don't know how MinGW looks through the path.
    When compiling, eclipse automatically compiles the program with command
    g++ -O0 -g3 -Wall -c -fmessage-length=0 -oexample.o ..\example.cpp
    g++ -omap.exe example.o
    #CPLEXOptimizers
    #DecisionOptimization


  • 8.  Re: undefined reference to `_imp__CPXopenCPLEX@4'

    Posted 12/09/10 12:18 PM

    Originally posted by: SystemAdmin


    I think you have the wrong library location. I think the library you need is C:\ILOG\CPLEX_Studio_AcademicResearch122\cplex\lib\...\cplex*.lib
    ('...' are one or two directories, '*' is the cplex version number, or it might even be the empty string).

    Are you sure the g++ commands you gave are correct? You did not specify any include files, so how did the compiler know about the CPLEX functions you are calling? It should give you at least warnings about using undeclared functions. Do you get such warnings?

    What you need is
    • for the compilation step: an additional include path C:\ILOG\CPLEX_Studio_AcademicResearch122\cplex\include
    - for the linking step: an additional library path C:\ILOG\CPLEX_Studio_AcademicResearch122\cplex\... (see above) and the additional library cplex*.lig (see above again)
    #CPLEXOptimizers
    #DecisionOptimization


  • 9.  Re: undefined reference to `_imp__CPXopenCPLEX@4'

    Posted 12/09/10 02:56 PM

    Originally posted by: mkmk


    For library location, which one should I choose? x86windows_vs2008? or x86.net2005_8.0

    Since I am not using vs compiler (using g++), I am not sure which library I should use.

    Also, under both x86windows_vs2008 and x86.net2005_8.0, there are stat_mda and stat_mta folders (both containing cplex122.lib)

    Which one is the correct one to use?

    I am pretty sure g++ comands are correct.
    Include files (.h) from MinGW are automatically linked in eclipse..

    in MinGW .h folder, I have already saved copies of cplex.h files, also C:\ILOG\CPLEX_Studio_AcademicResearch122\cplex\include is already set.

    I think the problem is linking library..
    Any clue on which .lib I should use?

    Thank you so much for helping me :)
    #CPLEXOptimizers
    #DecisionOptimization


  • 10.  Re: undefined reference to `_imp__CPXopenCPLEX@4'

    Posted 12/10/10 01:01 AM

    Originally posted by: SystemAdmin


    You copied the header files to your project directory? Bad idea. I am using eclipse for C on Linux and it works perfectly.
    I think you should do the following to configure it properly:
    • Go to Project->Properties
    • Go to C/C++Build->Settings
    • In GCC C++ compiler->Directories add C:\ILOG\CPLEX_Studio_AcademicResearch122\cplex\include
    • In GCC C++ Linker->Libraries add library cplex and library search path C:\ILOG\CPLEX_Studio_AcademicResearch122\cplex\lib\x86_windows_vs2008\stat_mta. On Linux I also have to add libraries pthread and m, don't know about Windows.

    #CPLEXOptimizers
    #DecisionOptimization


  • 11.  Re: undefined reference to `_imp__CPXopenCPLEX@4'

    Posted 12/10/10 03:02 PM

    Originally posted by: GuangFeng


    MinGW is not officially supported. You can find the list of supported compilers at Detailed hardware and software requirements for IBM ILOG CPLEX Optimization Studio

    For an unsupported compiler, even if you could make it work now, it may break any time in the future. So please use an officially supported compiler.
    #CPLEXOptimizers
    #DecisionOptimization