I had the same problem and managed to solve it today. However, I know nothing about Nuget and I'm no expert in build mechanics. So my solution is surely messy and far from optimal, but it worked for me so I hope it can help you too. I assume you used the official windows branch led by microsoft (https://github.com/BVLC/caffe/tree/windows), here are the steps I followed:
Add libCaffe project to your solution
- Copy these files to your project folder :
- caffe\windows\CommonSettings.targets
- caffe\windows\CommonSettings.props
- caffe\windows\scritps\ folder
- Right click your solution -> add existing project -> select caffe\windows\libcaffe\libcaffe.vcxproj
Add libcaffe as a reference
According to these issues :
https://github.com/Microsoft/caffe/issues/48
https://github.com/Microsoft/caffe/issues/45
- Project properties -> common properties -> References -> Add a new reference
- Select libcaffe
- Set Use Library Dependency Inputs as True
Add includes
Project properties-> Config settings -> C/C++ ->General -> other include directories -> select a directory with all includes needed :
This is where I am quite sure we can find better because I had to gather all the include directories from caffe (caffe\include) and all it's dependencies (gflags, glog, etc...) by hand. Just try to compile from time to time to see what's missing.
Add libraries
First, give the path where you will gather all libraries :
Project properties -> Config settings -> Linker -> General -> Additional library directories
Then you have to explicitly link (at least I had to) : Project properties -> Config settings -> Linker -> Input -> additionnal dependencies
Here are the one I had to add :
cudart.lib;cuda.lib;nppi.lib;cufft.lib;cublas.lib;curand.lib;Shlwapi.lib;hdf5.lib;hdf5_hl.lib;opencv_highgui2410.lib;opencv_core2410.lib;
Plus some others that are in "inherited values" : cpprest120_2_6.lib
cudnn.lib;gflags.lib;gflags_nothreads.lib;leveldb.lib;libglog.lib;libhdf5.lib;libhdf5_hl.lib;libopenblas.dll.a;libprotobuf.lib;lmdb.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib
Maybe some of it are specific to my application, but at least these worked for me.
You can find most of them in the extracted folder "NugetPackages".
Additional problem
In my case, I was using boost 1.56 in my project, but caffe uses the 1.59 version, so there was a conflict, I followed an answer from error LNK2005, already defined? and added the FORCE:MULTIPLE option : Project properties -> Config settings -> Linker -> General -> Force output
Again, this may not be the best solution, any time I use "FORCE"-something, I get this bad feeling...
Add dlls in the executable directory
You should find most of them in the build directory. I was missing libgflags which I downloaded from https://github.com/ChenglongChen/caffe-windows/tree/master/bin
Hope this helps.
PS : My Visual is in French, I tried to translate the options as well as i could.