Decision Optimization

Decision Optimization

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

 View Only
  • 1.  Compiler error with CPLEX 12.8 and Netbeans on Windows

    Posted Tue August 25, 2020 10:38 PM
    I have a linux machine as well as a windows machine.

    I have CPLEX 12.8 installed on both. I have had no problem using Netbeans 8.2 C++ ide on Linux using GNU-Linux toolset. Yet, the same attempt on Windows using MinGW-Windows runs into a compilation error.

    On Linux, the following command works:

    g++ -fPIC -fno-strict-aliasing -fexceptions -fopenmp -c -g -DIL_STD -D_LINDEBUG -I/opt/ibm/ILOG/CPLEX_Studio128/cplex/include -std=c++14 -MMD -MP -MF "build/Debug/GNU-Linux/_ext/5c0/Main.o.d" -o build/Debug/GNU-Linux/_ext/5c0/Main.o ../Main.cpp

    On Windows, however, the equivalent command 

    g++ -fPIC -fno-strict-aliasing -fexceptions -fopenmp -c -g -DIL_STD -D_WINNB -I/C/Program\ Files/IBM/ILOG/CPLEX_Studio128/cplex/include -I/C/local/boost_1_72_0 -std=c++14 -MMD -MP -MF "build/Debug/MinGW-Windows/_ext/5c0/Main.o.d" -o build/Debug/MinGW-Windows/_ext/5c0/Main.o ../Main.cpp

    runs into a host of CPLEX files compilation error. The initial errors are:

    g++ -fPIC -fno-strict-aliasing -fexceptions -fopenmp -c -g -DIL_STD -D_WINNB -I/C/Program\ Files/IBM/ILOG/CPLEX_Studio128/cplex/include -I/C/local/boost_1_72_0 -std=c++14 -MMD -MP -MF "build/Debug/MinGW-Windows/_ext/5c0/Main.o.d" -o build/Debug/MinGW-Windows/_ext/5c0/Main.o ../Main.cpp
    c:/Program Files/IBM/ILOG/CPLEX_Studio128/cplex/include/ilcplex/cpxconst.h:230:62: error: expected ')' before 'deprecated'
    230 | # define CPXDEPRECATEDAPI(version) __declspec(dllimport deprecated)
    | ^~~~~~~~~~
    c:/Program Files/IBM/ILOG/CPLEX_Studio128/cplex/include/ilcplex/cplex.h:43:1: note: in expansion of macro 'CPXDEPRECATEDAPI'
    43 | CPXDEPRECATEDAPI(12080000)
    | ^~~~~~~~~~~~~~~~
    c:/Program Files/IBM/ILOG/CPLEX_Studio128/cplex/include/ilcplex/cpxconst.h:230:41: note: to match this '('
    230 | # define CPXDEPRECATEDAPI(version) __declspec(dllimport deprecated)
    | ^~~~~~~~~~
    c:/Program Files/IBM/ILOG/CPLEX_Studio128/cplex/include/ilcplex/cplex.h:43:1: note: in expansion of macro 'CPXDEPRECATEDAPI'
    43 | CPXDEPRECATEDAPI(12080000)
    | ^~~~~~~~~~~~~~~~
    c:/Program Files/IBM/ILOG/CPLEX_Studio128/cplex/include/ilcplex/cpxconst.h:230:62: error: expected ')' before 'deprecated'
    230 | # define CPXDEPRECATEDAPI(version) __declspec(dllimport deprecated)
    | ^~~~~~~~~~
    c:/Program Files/IBM/ILOG/CPLEX_Studio128/cplex/include/ilcplex/cplex.h:43:1: note: in expansion of macro 'CPXDEPRECATEDAPI'
    43 | CPXDEPRECATEDAPI(12080000)

    Is there anything obvious that I am not doing correct?

    Thanks.

    ------------------------------
    CPLEX User
    ------------------------------

    #DecisionOptimization


  • 2.  RE: Compiler error with CPLEX 12.8 and Netbeans on Windows

    Posted Wed August 26, 2020 12:29 AM
    CPLEX does not officially support g++ on Windows.

    If you look at the offending part in cpxconst.h then you can see that there are platform specific macro definitions. It seems that g++ does not understand the definitions provided for Windows there (the officially supported compilers do understand them). You can try to modify cpxconst.h and add this code after the definition of all these macros:
    #undef CPXDEPRECATEDAPI #define CPXDEPRECATEDAPI CPXLIBAPI ​

    I never tried this myself, so I am not sure it will fix the issue.



    ------------------------------
    Daniel Junglas
    ------------------------------



  • 3.  RE: Compiler error with CPLEX 12.8 and Netbeans on Windows

    Posted Wed August 26, 2020 12:40 AM
    Daniel,

    Thanks. So, does this mean that on Windows, Netbeans would have to use the Microsoft Visual Studio tool chain only if I don't want to get into modifying CPLEX header files on my own?

    ------------------------------
    CPLEX User
    ------------------------------



  • 4.  RE: Compiler error with CPLEX 12.8 and Netbeans on Windows

    Posted Wed August 26, 2020 12:51 AM
    Yes, correct. If you switch to the Microsoft Visual Studio toolchain then things should work out of the box.

    ------------------------------
    Daniel Junglas
    ------------------------------