What Arlaharen said was basically right, except he left out the part which explains your linker errors. First of all, you need to build your application 没有 the CRT as a runtime library. You should always do this anyways, as it really simplifies distribution of your application. If you don't do this, then all of your users need the Visual C++ Runtime Library installed, and those who do not will complain about mysterious DLL's missing on their system... for the extra few hundred kilobytes that it costs to link in the CRT statically, you save yourself a lot of headache later in support (trust me on this one -- I've learned it the hard way!).
如果不想为测试编写自己的 main ()函数,可以使用 gtest _ main 中定义的 main ()函数。但是在 VS2012中你会得到链接器错误“入口点必须被定义”。
在您的测试项目集 ProjectProperties-> Linker-> System-> SubSystem to“ Console”中,这将强制 VS2012查找名为“ main ()”的入口点,并在 gtest _ main 中找到它。Lib (如果您已经正确地链接了它)。