问题
I am trying to build caffe (libcaffe,pycaffe) on windows using Visual studio. I downloaded the caffe-master project from below link
Caffe for windows
using visual studio 2015 and open the solution caffe in it. enabled python support true to build
some nuget-packages were missing so restore them. for this followed the link
How to install caffe in windows in five minutes
try to build the project but getting following errors:
C2059 syntax error: 'constant' (compiling source file ..\..\src\caffe\layer.cpp) libcaffe D:\caffe-master\caffe-master\include\caffe\proto\caffe.pb.h 2525
C2238 unexpected token(s) preceding ';' (compiling source file ..\..\src\caffe\layer.cpp) libcaffe D:\caffe-master\caffe-master\include\caffe\proto\caffe.pb.h 2525
C2059 syntax error: 'constant' (compiling source file ..\..\src\caffe\data_reader.cpp) libcaffe D:\caffe-master\caffe-master\include\caffe\proto\caffe.pb.h 2525
C2238 unexpected token(s) preceding ';' (compiling source file ..\..\src\caffe\data_reader.cpp) libcaffe D:\caffe-master\caffe-master\include\caffe\proto\caffe.pb.h 2525
C2059 syntax error: 'constant' (compiling source file ..\..\src\caffe\layer.cpp) libcaffe D:\caffe-master\caffe-master\include\caffe\proto\caffe.pb.h 9806
C2238 unexpected token(s) preceding ';' (compiling source file ..\..\src\caffe\layer.cpp) libcaffe D:\caffe-master\caffe-master\include\caffe\proto\caffe.pb.h 9806
C2059 syntax error: 'constant' (compiling source file ..\..\src\caffe\data_reader.cpp) libcaffe D:\caffe-master\caffe-master\include\caffe\proto\caffe.pb.h 9806
C2238 unexpected token(s) preceding ';' (compiling source file ..\..\src\caffe\data_reader.cpp) libcaffe D:\caffe-master\caffe-master\include\caffe\proto\caffe.pb.h 9806
C2059 syntax error: 'constant' (compiling source file ..\..\src\caffe\layers\base_data_layer.cpp) libcaffe D:\caffe-master\caffe-master\include\caffe\proto\caffe.pb.h 2525
C2238 unexpected token(s) preceding ';' (compiling source file ..\..\src\caffe\layers\base_data_layer.cpp) libcaffe D:\caffe-master\caffe-master\include\caffe\proto\caffe.pb.h 2525
C2059 syntax error: 'constant' (compiling source file ..\..\src\caffe\layers\base_data_layer.cpp) libcaffe D:\caffe-master\caffe-master\include\caffe\proto\caffe.pb.h 9806
C2238 unexpected token(s) preceding ';' (compiling source file ..\..\src\caffe\layers\base_data_layer.cpp) libcaffe D:\caffe-master\caffe-master\include\caffe\proto\caffe.pb.h 9806
C1083 Cannot open include file: 'pyconfig.h': No such file or directory (compiling source file ..\..\src\caffe\layer_factory.cpp) libcaffe D:\caffe-master\NugetPackages\boost.1.66.0.0\lib\native\include\boost\python\detail\wrap_python.hpp 50
C2059 syntax error: 'constant' (compiling source file ..\..\src\caffe\parallel.cpp) libcaffe D:\caffe-master\caffe-master\include\caffe\proto\caffe.pb.h 2525
C2238 unexpected token(s) preceding ';' (compiling source file ..\..\src\caffe\parallel.cpp) libcaffe D:\caffe-master\caffe-master\include\caffe\proto\caffe.pb.h 2525
C2059 syntax error: 'constant' (compiling source file ..\..\src\caffe\parallel.cpp) libcaffe D:\caffe-master\caffe-master\include\caffe\proto\caffe.pb.h 9806
C2238 unexpected token(s) preceding ';' (compiling source file ..\..\src\caffe\parallel.cpp) libcaffe D:\caffe-master\caffe-master\include\caffe\proto\caffe.pb.h 9806
C2059 syntax error: 'constant' (compiling source file ..\..\src\caffe\util\blocking_queue.cpp) libcaffe D:\caffe-master\caffe-master\include\caffe\proto\caffe.pb.h 2525
C2238 unexpected token(s) preceding ';' (compiling source file ..\..\src\caffe\util\blocking_queue.cpp) libcaffe D:\caffe-master\caffe-master\include\caffe\proto\caffe.pb.h 2525
C2059 syntax error: 'constant' (compiling source file ..\..\src\caffe\util\blocking_queue.cpp) libcaffe D:\caffe-master\caffe-master\include\caffe\proto\caffe.pb.h 9806
C2238 unexpected token(s) preceding ';' (compiling source file ..\..\src\caffe\util\blocking_queue.cpp) libcaffe D:\caffe-master\caffe-master\include\caffe\proto\caffe.pb.h 9806
C1083 Cannot open include file: 'Python.h': No such file or directory pycaffe D:\caffe-master\caffe-master\python\caffe\_caffe.cpp 1
I have already installed boost-python from nuget-packages but it is still showing cannot open include file Python.h
来源:https://stackoverflow.com/questions/54325487/build-caffe-pycaffe-on-windows-using-visual-studio-error