coin-or / Cbc.old

This is a mirror of the subversion repository on COIN-OR
https://projects.coin-or.org/Cbc
Other
88 stars 30 forks source link

[Trac #163] CBC doesn't build in VS2013 #47

Open s-c-e opened 5 years ago

s-c-e commented 5 years ago

image

I've been unsuccessful in building CBC using Cbc\stable\2.9\Cbc\MSVisualStudio\v10 with MS Visual Studio 2013. I get two linker errors: Error 59 error LNK2019: unresolved external symbol "int cdecl CbcMain1(int,char const const,class CbcModel? &)" (?CbcMain1@@YAHHQAPBDAAVCbcModel@@@Z) referenced in function _Cbc_solve@4 C:\Projects\Cbc\stable\2.9\Cbc\MSVisualStudio\v9\cbcCInterfaceDll\Cbc_C_Interface.obj cbcCInterfaceDll

and

Error 58 error LNK2019: unresolved external symbol "void cdecl CbcMain0(class CbcModel? &)" (?CbcMain0@@YAXAAVCbcModel@@@Z) referenced in function _Cbc_newModel@0 C:\Projects\Cbc\stable\2.9\Cbc\MSVisualStudio\v9\cbcCInterfaceDll\Cbc_C_Interface.obj cbcCInterfaceDll

Nor can I find the CBC binaries for windows for recent versions at

http://www.coin-or.org/Binaries/Cbc/

Nor do the older versions of those binaries contain what I think are the cbc dll's referred to in ticket #99 for use with other projects.

=========================

I've managed to build the C interface DLL using the MSVC 2015 build tools. You need to make the following change in cbcCInterfaceDll.vcxproj:

Change:

<AdditionalDependencies?>libOsiClp.lib;%(AdditionalDependencies?)</AdditionalDependencies?>

To:

<AdditionalDependencies?>libCbcSolver.lib;libCbc.lib;libCgl.lib;libOsiClp.lib;libOsi.lib;libClp.lib;libCoinUtils.lib;%(AdditionalDependencies?)</AdditionalDependencies?>

There are 4 instances to replace (one for each build target).

I built this using the command line tools. You need to re-enable this project in the solution file.

msbuild Cbc.sln /p:PlatformToolset=v140 /p:Configuration=Release /p:Platform=x64

The resulting DLL seems to function as expected. I'm using it from Python with the ctypes library.