问题描述
C ++-Protobuf在VS2012中无法编译.现在,我想使用MinGW在Windows上对其进行编译.有人可以给我简要介绍一下如何在Win7 x64上编译protobuf的方法.我已经使用GUI安装程序安装了MinGW. Google写为MinGW设置通知,我应该参考Unix安装说明.但是我不知道如何在Windows上使用自动工具.
C++-Protobuf does not compile in VS2012. Now I want to use MinGW to compile it on windows. Can someone please give me some brief headwords on how to compile protobuf on Win7 x64. I already installed MinGW with the GUI installer. Google writes as MinGW setup notice that I should refer to the Unix installation notes. But I cant figure out how to use the auto tools on windows.
修改
好吧,这是我到目前为止所做的:
Okay this is what I've done until now:
$ mount C:/ WinDir
$ cd ./[...]/protobuf.2.4.1
$ ./configure
$ minGW32-make.exe
$ minGW32-make.exe check
minGW32-make.exe运行没有错误,但没有任何测试正在运行,我找不到libprotobuf.lib.有一些libprotobuf.dll,但是我需要lib,不是吗?.
minGW32-make.exe runs without errors, but no tests are running and I cant find libprotobuf.lib. There are some libprotobuf.dll but I need the lib, dont I?.
推荐答案
您应该同时具有MSys控制台和MinGW安装.该控制台提供了一个类似linux的环境,您应该可以在其中正常使用自动工具.
You should have an MSys console together with your MinGW instalation. This console provides an linux-like environment in which you should be able to use autotools normally.
如果未安装MSys,您也可以从MinGW站点中获取它.
If MSys is not installed, you can grab it from the MinGW site too.
cd
到带有源的目录,然后尝试通常的方法:
cd
to your directory with sources and try the usual:
$ ./configure
$ make
某些库在Windows上引起问题,但大多数库可以使用MinGW和MSys很好地编译.如果遇到特定问题,请回来为您的问题添加更多信息.
Some libraries cause problems on Windows but most compile well with MinGW and MSys. Come back and add more info to your question if you run into specific problems.
通常,对于动态库,您将获得protobuf.dll
(动态库)和libprotobuf.a
(静态包装器库).
Usually for a dynamic library you'd get protobuf.dll
(the dynamic library) and libprotobuf.a
(the static wrapper library).
链接时,只需将-lprotobuf
传递给链接器-它将同时查找libprotobuf.a
和protobuf.lib
.
When linking, just pass -lprotobuf
to the linker - it will look for both libprotobuf.a
and protobuf.lib
.
(.lib
是另一种静态库格式,它由MinGW进行部分处理,但此处不是本地的.)
(.lib
is another static library format, which is partially handled by MinGW but not native here.)
这篇关于如何在Windows上安装protobuf? (Win7x64/MinGW)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!