Decision Optimization

Decision Optimization

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

 View Only
  • 1.  Eclipse C++ IDE and Cplex on Wİndows

    Posted Wed May 01, 2019 07:25 AM

    Originally posted by: istenc


    Hi,

    I am used to  use VS 2015 to write a C++ project calling Cplex on Windows. I need to shift to Eclipse now and i downloaded Eclipse C++ 2019-03 IDE , accordingly. However, I couldn't find anything about linking Eclipse C++ IDE and Cplex on Wİndows. I would appreaciate if you can help me on that.

    Best,

    İstenç


    #CPLEXOptimizers
    #DecisionOptimization


  • 2.  Re: Eclipse C++ IDE and Cplex on Wİndows

    Posted Wed May 01, 2019 11:35 AM

    I don't have experience with this, but here is an old article (from 2006) that might be helpful. I could be wrong, but the challenges discussed in the article are probably still relevant. Namely, you'll have to use the Microsoft compiler tool chain (this is stated in the detailed system requirements for CPLEX), you won't be able to debug (Eclipse doesn't recognize the debugging information generated by the Microsoft compiler), and there is no visual support for GUI programming.

     

    On the other hand, you can use Eclipse for CPLEX C++ development on Linux and macOS without issues. I believe you'll find other threads in this forum on that subject.

     

    EDIT: Here is a current link about using Eclipse CDT. Here the important part:

    The Windows SDK provides the Visual C++ compiler and header files and libraries required to create Windows applications. The CDT Visual C++ build integration will find these files based on where you installed the SDK. No other setup is required.

    Note: For this release, the integration should be considered beta quality. It is not recommended for production use.


    #CPLEXOptimizers
    #DecisionOptimization


  • 3.  Re: Eclipse C++ IDE and Cplex on Wİndows

    Posted Wed May 01, 2019 02:41 PM

    Originally posted by: T_O


    Another possibility is to just use the plain C-API in your C++-Code. This works fine on Windows with MinGW (it should work with any compiler).

    In fact, I like the C-API more than Concert with its overhead. Still, it might be a little more difficult to understand and use.

    Best regards,
    Thomas


    #CPLEXOptimizers
    #DecisionOptimization


  • 4.  Re: Eclipse C++ IDE and Cplex on Wİndows

    Posted Wed May 01, 2019 05:00 PM

    Even using the C-API, things are not so clear cut. The CPLEX C Callable Library is built against a specific version of the Microsoft Visual C/C++ Runtime. This is why you see folders like x64_windows_vs2015 and x64_windows_vs2017 under the <CPLEXDIR>/lib directory. Be careful mixing different C runtimes (e.g., from MingGW); it may lead to random failures.


    #CPLEXOptimizers
    #DecisionOptimization


  • 5.  Re: Eclipse C++ IDE and Cplex on Wİndows

    Posted Thu May 02, 2019 01:28 AM

    Originally posted by: T_O


    I think you might be right. Still, I have to say that I never experienced any problems with this approach.

    You have to do things like

    gendef.exe cplex1262.dll
    dlltool --output-lib libcplex1262.a --input-def cplex1262.def --dllname=cplex1262.dll
    

    and set some preprocessor/linker flags (-D_LP64, -lcplex1261). Then I never saw any problems.

    Of course, the best way here is to use the same compiler that the library was built with. But sometimes one wants to use other libraries that are hardly to build with VS.

    Best regards,
    Thomas


    #CPLEXOptimizers
    #DecisionOptimization


  • 6.  Re: Eclipse C++ IDE and Cplex on Wİndows

    Posted Thu May 02, 2019 01:29 AM

    Expanding on what others already said: First of all, you have to setup eclipse so that it can build general C++ projects with the microsoft compiler. For this you need the CDT plugin. Once your have set this up and can build a simple hello world binary figure out how to link 3rd part libraries with CDT (you have to set compiler include paths and linker settings). From there setting things up for CPLEX should not be too hard. Either adapt the information in c_cpp.html or

    - run your project one last time in Visual Studio
    - look at the compiler and linker command line used for building in Visual Studio
    - configure CDT so that it uses the the compiler and linker command lines

    PS: I don't think it matters here whether you use the Visual Studio compilers or MinGW as Thomas suggested: the setup process for CDT will be very similar, it will differ only in some linker flags.


    #CPLEXOptimizers
    #DecisionOptimization


  • 7.  Re: Eclipse C++ IDE and Cplex on Wİndows

    Posted Fri May 03, 2019 10:07 AM

    Originally posted by: istenc


    I setup eclipse so as to generate C++ projects and tried to link cplex thereafter. I am very ignorant in this kind of staff but I think visual studio compiler must be used in my case (i tried mingw but it didnt see the libraries pertaining to cplex although i added necessary paths etc.). Visual studio compiler seems to work fine but it cannot handle C headers. I defined IL_STD and added paths for Windows SDK and VC directory of the visual studio. Yet, it still gives me fatal errors like

    "C:\Program Files\IBM\ILOG\CPLEX_Studio129\concert\include\ilconcert/ilosys.h(120): fatal error C1083: Cannot open include file: 'stddef.h': No such file or directory".

    I will update the thread if i overcome this problem.

    Thanks to all contributed to this thread.


    #CPLEXOptimizers
    #DecisionOptimization


  • 8.  Re: Eclipse C++ IDE and Cplex on Wİndows

    Posted Fri May 03, 2019 11:31 AM

    Originally posted by: T_O


    Did you by accident set IL_STD for the C compiler instead of the C++ compiler?

    Best regards,
    Thomas


    #CPLEXOptimizers
    #DecisionOptimization


  • 9.  Re: Eclipse C++ IDE and Cplex on Wİndows

    Posted Sun May 05, 2019 07:22 AM

    Originally posted by: istenc


    No, I set it for C++ compiler. My mistake was to add  Windows SDK path as "C:\Program Files (x86)\Windows Kits\10\Include". When I changed it to C:\Program Files (x86)\Windows Kits\10\Include\10.0.10150.0\ucrt", the problem has been solved.

    Best,

    İstenç


    #CPLEXOptimizers
    #DecisionOptimization