如何编译googletest在windows上使用mingw和msys? [英] How to compile googletest on windows using mingw with msys?
问题描述
我的需要很简单。我必须编译和使用googletest在Windows上使用MinGW与msys。有没有人有这样的经验?
感谢您的回答。
它花了我一些时间,但我想出来了。
要在Windows上编译GoogleTest,请按照以下说明操作:
$ b $
从官方网站下载并安装CMake
a href =http://www.cmake.org/> http://www.cmake.org/ 。使用Win32安装程序版本。完成安装过程后,将可执行文件从
xxx / CMake / bin复制到xxx / MinWG / bin。
并从 http://www.python.org/ 安装Python。再次,Windows安装程序做的工作
罚款。
一旦你完成安装过程将python.exe
form python文件夹复制到
xxx / MinWG / bin。
运行MSYS终端并执行以下命令。
cd xxx / gtest-xxx
cmake -GMSYS Makefiles
make
li>
如果您有来自pthread的编译错误,请按照这条说明操作。
将include文件夹xxx / gtest-x.x.x / include复制到MinGW gcc include中。
将库文件xxx / gtest-xxx / *。a复制到您的MinGW gcc库中。
<
EDIT
评论者是正确的。可执行文件的应对为我工作,但一般来说这不是一个好的做法。尝试使用符号链接。
My need is simple. I have to compile and use googletest on windows using MinGW with msys. Has anyone some experience doing this?
Thanks for answers.
It took me some time but I figured it out. Here is the guide for anyone who face the same problem.
To be able to compile GoogleTest on Windows follow this instructions:
I assume you have MinGW with MSYS istalled.
Download and install CMake from the official site http://www.cmake.org/. Use the Win32 installer version. Once you have completed the installation process copy executable files from "xxx/CMake/bin" to "xxx/MinWG/bin".
Download and install Python from http://www.python.org/. Again, the Windows installer does the job fine. Once you have completed the installation process copy the "python.exe" form python folder to "xxx/MinWG/bin".
Download the latest stable GoogleTest from http://code.google.com/p/googletest/ and unpack it into some folder.
Run MSYS terminal and execute following commands.
cd xxx/gtest-x.x.x cmake -G "MSYS Makefiles" make
If you have compilation errors from pthread follow these instructions.
Copy the include folder "xxx/gtest-x.x.x/include" into your MinGW gcc include. Copy the library files "xxx/gtest-x.x.x/*.a" into your MinGW gcc lib.
When you compile tests add "-lgtest" parameter to gcc.
EDIT Commentators are right. The coping of executables worked for me but generaly it is not a good practice. Try to use a symbolic link instead.
这篇关于如何编译googletest在windows上使用mingw和msys?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!