1

I try to solve a very large optimization problem in R, so I wanted to install rcplex, but got much problems (see Install rcplex on windows). Cause its more recently updated I'm trying to install cplexAPi and followed this https://cran.r-project.org/web/packages/cplexAPI/INSTALL for windows 10. So I changed the makevars.win file to

PKG_CPPFLAGS=-g -D_R_=1 -DUSE_R=1 -I"C:\Program Files\IBM\ILOG\CPLEX_Studio_Community1210\cplex\include"
PKG_LIBS=-L"C:\Program Files\IBM\ILOG\CPLEX_Studio_Community1210\cplex\bin\x64_win64" -lm -lcplex12100

and get

"C:\Program Files\R\R-4.0.2\bin\x64\R.exe" CMD  build --no-build-vignettes --no-manual --md5 C:/Users/Jonas/Desktop/cplexAPI
* checking for file 'C:/Users/Jonas/Desktop/cplexAPI/DESCRIPTION' ... OK
* preparing 'cplexAPI':
* checking DESCRIPTION meta-information ... OK
* cleaning src
* checking vignette meta-information ... OK
* checking for LF line-endings in source and make files and shell scripts
* checking for empty or unneeded directories
* adding MD5 file
* building 'cplexAPI_1.4.0.tar.gz'
Warning: file 'cplexAPI/cleanup' did not have execute permissions: corrected
Warning: file 'cplexAPI/configure' did not have execute permissions: corrected

and

"C:\Program Files\R\R-4.0.2\bin\x64\R.exe" CMD INSTALL --build --no-multiarch .\cplexAPI_1.4.0.tar.gz
* installing to library 'C:/Users/Jonas/Documents/R/win-library/4.0'
* installing *source* package 'cplexAPI' ...
** package 'cplexAPI' successfully unpacked and MD5 sums checked
** using staged installation
** libs
"C:/rtools/mingw64/bin/"gcc  -I"C:/PROGRA~1/R/R-40~1.2/include" -DNDEBUG -g -D_R_=1 -DUSE_R=1 -I"C:\Program Files\IBM\ILOG\CPLEX_Studio_Community1210\cplex\include"         -O2 -Wall  -std=gnu99 -mfpmath=sse -msse2 -mstackrealign -c cplexAPI.c -o cplexAPI.o
C:\Program Files\IBM\ILOG\CPLEX_Studio_Community1210\cplex\include/ilcplex/cpxconst.h:251:62: error: expected ')' before 'deprecated'
 #      define CPXDEPRECATEDAPI(version) __declspec(dllimport deprecated)
                                                              ^~~~~~~~~~
C:\Program Files\IBM\ILOG\CPLEX_Studio_Community1210\cplex\include/ilcplex/cplex.h:1214:1: note: in expansion of macro 'CPXDEPRECATEDAPI'
 CPXDEPRECATEDAPI(12090000)
 ^~~~~~~~~~~~~~~~
C:\Program Files\IBM\ILOG\CPLEX_Studio_Community1210\cplex\include/ilcplex/cpxconst.h:251:41: error: expected identifier or '(' before ')' token
 #      define CPXDEPRECATEDAPI(version) __declspec(dllimport deprecated)
                                         ^~~~~~~~~~
C:\Program Files\IBM\ILOG\CPLEX_Studio_Community1210\cplex\include/ilcplex/cplex.h:1214:1: note: in expansion of macro 'CPXDEPRECATEDAPI'
 CPXDEPRECATEDAPI(12090000)
 ^~~~~~~~~~~~~~~~
C:\Program Files\IBM\ILOG\CPLEX_Studio_Community1210\cplex\include/ilcplex/cpxconst.h:251:62: error: expected ')' before 'deprecated'
 #      define CPXDEPRECATEDAPI(version) __declspec(dllimport deprecated)
                                                              ^~~~~~~~~~
C:\Program Files\IBM\ILOG\CPLEX_Studio_Community1210\cplex\include/ilcplex/cplex.h:1220:1: note: in expansion of macro 'CPXDEPRECATEDAPI'
 CPXDEPRECATEDAPI(12090000)
 ^~~~~~~~~~~~~~~~
C:\Program Files\IBM\ILOG\CPLEX_Studio_Community1210\cplex\include/ilcplex/cpxconst.h:251:41: error: expected identifier or '(' before ')' token
 #      define CPXDEPRECATEDAPI(version) __declspec(dllimport deprecated)
                                         ^~~~~~~~~~
C:\Program Files\IBM\ILOG\CPLEX_Studio_Community1210\cplex\include/ilcplex/cplex.h:1220:1: note: in expansion of macro 'CPXDEPRECATEDAPI'
 CPXDEPRECATEDAPI(12090000)
 ^~~~~~~~~~~~~~~~
C:\Program Files\IBM\ILOG\CPLEX_Studio_Community1210\cplex\include/ilcplex/cpxconst.h:251:62: error: expected ')' before 'deprecated'
 #      define CPXDEPRECATEDAPI(version) __declspec(dllimport deprecated)
                                                              ^~~~~~~~~~
C:\Program Files\IBM\ILOG\CPLEX_Studio_Community1210\cplex\include/ilcplex/cplex.h:1251:1: note: in expansion of macro 'CPXDEPRECATEDAPI'
 CPXDEPRECATEDAPI(12090000)
 ^~~~~~~~~~~~~~~~
C:\Program Files\IBM\ILOG\CPLEX_Studio_Community1210\cplex\include/ilcplex/cpxconst.h:251:41: error: expected identifier or '(' before ')' token
 #      define CPXDEPRECATEDAPI(version) __declspec(dllimport deprecated)
                                         ^~~~~~~~~~
C:\Program Files\IBM\ILOG\CPLEX_Studio_Community1210\cplex\include/ilcplex/cplex.h:1251:1: note: in expansion of macro 'CPXDEPRECATEDAPI'
 CPXDEPRECATEDAPI(12090000)
 ^~~~~~~~~~~~~~~~
C:\Program Files\IBM\ILOG\CPLEX_Studio_Community1210\cplex\include/ilcplex/cpxconst.h:251:62: error: expected ')' before 'deprecated'
 #      define CPXDEPRECATEDAPI(version) __declspec(dllimport deprecated)
                                                              ^~~~~~~~~~
C:\Program Files\IBM\ILOG\CPLEX_Studio_Community1210\cplex\include/ilcplex/cplex.h:1257:1: note: in expansion of macro 'CPXDEPRECATEDAPI'
 CPXDEPRECATEDAPI(12090000)
 ^~~~~~~~~~~~~~~~
C:\Program Files\IBM\ILOG\CPLEX_Studio_Community1210\cplex\include/ilcplex/cpxconst.h:251:41: error: expected identifier or '(' before ')' token
 #      define CPXDEPRECATEDAPI(version) __declspec(dllimport deprecated)
                                         ^~~~~~~~~~
C:\Program Files\IBM\ILOG\CPLEX_Studio_Community1210\cplex\include/ilcplex/cplex.h:1257:1: note: in expansion of macro 'CPXDEPRECATEDAPI'
 CPXDEPRECATEDAPI(12090000)
 ^~~~~~~~~~~~~~~~
C:\Program Files\IBM\ILOG\CPLEX_Studio_Community1210\cplex\include/ilcplex/cpxconst.h:251:62: error: expected ')' before 'deprecated'
 #      define CPXDEPRECATEDAPI(version) __declspec(dllimport deprecated)
                                                              ^~~~~~~~~~
C:\Program Files\IBM\ILOG\CPLEX_Studio_Community1210\cplex\include/ilcplex/cplex.h:1262:1: note: in expansion of macro 'CPXDEPRECATEDAPI'
 CPXDEPRECATEDAPI(12090000)
 ^~~~~~~~~~~~~~~~
C:\Program Files\IBM\ILOG\CPLEX_Studio_Community1210\cplex\include/ilcplex/cpxconst.h:251:41: error: expected identifier or '(' before ')' token
 #      define CPXDEPRECATEDAPI(version) __declspec(dllimport deprecated)
                                         ^~~~~~~~~~
C:\Program Files\IBM\ILOG\CPLEX_Studio_Community1210\cplex\include/ilcplex/cplex.h:1262:1: note: in expansion of macro 'CPXDEPRECATEDAPI'
 CPXDEPRECATEDAPI(12090000)
 ^~~~~~~~~~~~~~~~
C:\Program Files\IBM\ILOG\CPLEX_Studio_Community1210\cplex\include/ilcplex/cpxconst.h:251:62: error: expected ')' before 'deprecated'
 #      define CPXDEPRECATEDAPI(version) __declspec(dllimport deprecated)
                                                              ^~~~~~~~~~
C:\Program Files\IBM\ILOG\CPLEX_Studio_Community1210\cplex\include/ilcplex/cplex.h:1617:1: note: in expansion of macro 'CPXDEPRECATEDAPI'
 CPXDEPRECATEDAPI(12090000)
 ^~~~~~~~~~~~~~~~
C:\Program Files\IBM\ILOG\CPLEX_Studio_Community1210\cplex\include/ilcplex/cpxconst.h:251:41: error: expected identifier or '(' before ')' token
 #      define CPXDEPRECATEDAPI(version) __declspec(dllimport deprecated)
                                         ^~~~~~~~~~
C:\Program Files\IBM\ILOG\CPLEX_Studio_Community1210\cplex\include/ilcplex/cplex.h:1617:1: note: in expansion of macro 'CPXDEPRECATEDAPI'
 CPXDEPRECATEDAPI(12090000)
 ^~~~~~~~~~~~~~~~
make: *** [C:/PROGRA~1/R/R-40~1.2/etc/x64/Makeconf:222: cplexAPI.o] Error 1
ERROR: compilation failed for package 'cplexAPI'
* removing 'C:/Users/Jonas/Documents/R/win-library/4.0/cplexAPI'

I don't know how to proceed now.

  • This [thread](https://community.ibm.com/community/user/datascience/communities/community-home/digestviewer/viewthread?MessageKey=3ddfcd6c-a949-41c9-95a5-4ca0b6e65f64&CommunityKey=ab7de0fd-6f43-47a9-8261-33578a231bb7&tab=digestviewer&SuccessMsg=Thank%20you%20for%20submitting%20your%20message) appears to solve the issue on linux. Maybe commenting there could solve the issue. – marty Oct 29 '20 at 01:26

1 Answers1

0

I have had the same error. The solution to this error is to add -DBUILD_CPXSTATIC at the end of the first line of Makevars.win, so that the file looks something like this:

PKG_CPPFLAGS=-g -D_R_=1 -DUSE_R=1 -I"${CPLEX_STUDIO_DIR}\cplex\include" -DBUILD_CPXSTATIC
PKG_LIBS=-L"${CPLEX_STUDIO_LIB}" -lm -lcplex1261
Jeremy Caney
  • 7,102
  • 69
  • 48
  • 77