久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

如何使用 Visual Studio 2005 設置 Google C++ 測試框架

How to set up Google C++ Testing Framework (gtest) with Visual Studio 2005(如何使用 Visual Studio 2005 設置 Google C++ 測試框架 (gtest))
本文介紹了如何使用 Visual Studio 2005 設置 Google C++ 測試框架 (gtest)的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

網站上沒有記錄,人們似乎在設置框架時遇到問題.有人可以展示示例項目設置的分步介紹嗎?

It is not documented on the web site and people seem to be having problems setting up the framework. Can someone please show a step-by-step introduction for a sample project setup?

推薦答案

Arlaharen 所說的基本上是對的,只是他省略了解釋鏈接器錯誤的部分.首先,您需要構建您的應用程序沒有 CRT 作為運行時庫.無論如何,您應該始終這樣做,因為它確實簡化了應用程序的分發.如果您不這樣做,那么您的所有用戶都需要安裝 Visual C++ 運行時庫,而那些不安裝的用戶會抱怨他們的系統上缺少神秘的 DLL……因為鏈接需要額外花費幾百 KB靜態地使用 CRT,您以后在支持方面會省去很多麻煩(相信我 - 我已經通過艱難的方式學會了它!).

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 without 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!).

無論如何,要做到這一點,你去目標的屬性 -> C/C++ -> 代碼生成 -> 運行時庫,它需要為你的發布版本設置為多線程"和多線程"Debug"用于您的調試版本.

Anyways, to do this, you go to the target's properties -> C/C++ -> Code Generation -> Runtime Library, and it needs to be set as "Multi-Threaded" for your Release build and "Multi-Threaded Debug" for your Debug build.

由于 gtest 庫是以相同的方式構建的,因此您需要確保鏈接的是 it 的正確版本,否則鏈接器將拉入運行時庫的另一個副本,這是您看到的錯誤(順便說一句,如果您使用 MFC,這應該沒有區別).您需要將 gtest 構建為調試和發布模式并保留兩個副本.然后,您在發布版本中鏈接 gtest.lib/gtest_main.lib,在調試版本中鏈接 gtestd.lib/gtest_maind.lib.

Since the gtest library is built in the same way, you need to make sure you are linking against the correct version of it, or else the linker will pull in another copy of the runtime library, which is the error you saw (btw, this shouldn't make a difference if you are using MFC or not). You need to build gtest as both a Debug and Release mode and keep both copies. You then link against gtest.lib/gtest_main.lib in your Release build and gtestd.lib/gtest_maind.lib in your Debug build.

此外,您需要確保您的應用程序指向存儲 gtest 頭文件的目錄(在屬性 -> C/C++ -> 常規 -> 附加包含目錄中),但如果遇到鏈接器錯誤,我假設您已經設法使這部分正確,否則您將首先處理更多的編譯器錯誤.

Also, you need to make sure that your application points to the directory where the gtest header files are stored (in properties -> C/C++ -> General -> Additional Include Directories), but if you got to the linker error, I assume that you already managed to get this part correct, or else you'd have a lot more compiler errors to deal with first.

這篇關于如何使用 Visual Studio 2005 設置 Google C++ 測試框架 (gtest)的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

How do I set the icon for my application in visual studio 2008?(如何在 Visual Studio 2008 中為我的應用程序設置圖標?)
Convert CString to const char*(將 CString 轉換為 const char*)
Remove secure warnings (_CRT_SECURE_NO_WARNINGS) from projects by default in Visual Studio(默認情況下,在 Visual Studio 中從項目中刪除安全警告 (_CRT_SECURE_NO_WARNINGS))
How do I start a new CUDA project in Visual Studio 2008?(如何在 Visual Studio 2008 中啟動新的 CUDA 項目?)
Exporting classes containing `std::` objects (vector, map etc.) from a DLL(從 DLL 導出包含 `std::` 對象(向量、映射等)的類)
What are some reasons a Release build would run differently than a Debug build(發布版本與調試版本的運行方式不同的一些原因是什么)
主站蜘蛛池模板: 黄色大片一级 | 青草国产 | 日韩中文视频 | 精品视频在线免费观看 | 在线视频日本 | 午夜不卡视频 | 国产三级一区 | 男女啪啪网站 | 九九热在线观看视频 | 久久久久久国产精品 | 日韩精品成人免费观看视频 | 国产一区二区三区四区 | 成人一区二区三区 | 天天色天天干天天 | 日韩欧美精品在线 | 久在线观看 | 少妇搡bbbb搡bbb搡毛茸茸 | 日韩专区中文字幕 | 天天看天天操 | 欧美视频亚洲视频 | 亚洲国产精品久久 | 夜夜肉她怀孕h周君彦 | 四虎影视最新网址 | 免费一级黄色 | 国产青青操| 日本色婷婷 | 91视频一区二区三区 | 黄色大片在线 | 亚洲激情网 | 亚洲乱色| 欧美美女视频 | 久久久综合网 | 欧美成人精品欧美一级乱黄 | 亚洲va国产va天堂va久久 | 性视频网址 | 国产永久视频 | 亚洲视频不卡 | 国产精品一级 | 成人毛片在线 | 午夜免费在线 | 一级特黄视频 |