coin-or / Osi

Open Solver Interface
Other
54 stars 41 forks source link

Using CPLEx with OSI #152

Closed sKamer73 closed 3 years ago

sKamer73 commented 3 years ago

Hi all,

First thank for your great job! I'm contacting you today as I've been trying for the past few hours to use CPLEX from an OsiSolverInterface. I've been successfully using CBC with OSI for the past months, but I need to use CPLEX for comparative purposes. I could download and install CPLEx v.20.10 with Academics institutionnal. I am using VS2019 and my OSI version is the one integrated in Cbc-2.10.5.

The issue I'm facing so far is the call of cplex library; I created a new project as libOsiCpx, which compiles correctly. Then in my main project, I added the reference of libOsiCpx, and the cplex library (cplex2010.lib) as Additional Dependencies. If I understood correctly, the displayed error message means that the cplew library is not loaded correctly?

1>libOsiCpx.lib(OsiCpxSolverInterface.obj) : error LNK2019: symbole externe non résolu __imp__CPXaddcols@44 référencé dans la fonction "public: virtual void __thiscall OsiCpxSolverInterface::addCol(class CoinPackedVectorBase const &,double,double,double)" (?addCol@OsiCpxSolverInterface@@UAEXABVCoinPackedVectorBase@@NNN@Z) 1>libOsiCpx.lib(OsiCpxSolverInterface.obj) : error LNK2019: symbole externe non résolu __imp__CPXaddfuncdest@16 référencé dans la fonction "private: void __thiscall OsiCpxSolverInterface::gutsOfConstructor(void)" (?gutsOfConstructor@OsiCpxSolverInterface@@AAEXXZ) 1>libOsiCpx.lib(OsiCpxSolverInterface.obj) : error LNK2019: symbole externe non résolu __imp__CPXaddrows@48 référencé dans la fonction "public: virtual void __thiscall OsiCpxSolverInterface::addRow(class CoinPackedVectorBase const &,char,double,double)" (?addRow@OsiCpxSolverInterface@@UAEXABVCoinPackedVectorBase@@DNN@Z) 1>libOsiCpx.lib(OsiCpxSolverInterface.obj) : error LNK2019: symbole externe non résolu __imp__CPXbinvacol@16 référencé dans la fonction "public: virtual void __thiscall OsiCpxSolverInterface::getBInvACol(int,double *)const " (?getBInvACol@OsiCpxSolverInterface@@UBEXHPAN@Z) And it goes on for 65 functions.

As I'm kind of new to C++ and those library considerations, it might be something "classic Cpp" that I just don't do well. I'm as well new to GitHub and all this, so please correct me if I'm not asking at the good place, etc.

If anyone could help me, it would be greatly appreciated.

Cheers! Simon