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

如何使用 Visual Studio 2005 設(shè)置 Google C++ 測(cè)試框架

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

問題描述

網(wǎng)站上沒有記錄,人們似乎在設(shè)置框架時(shí)遇到問題.有人可以展示示例項(xiàng)目設(shè)置的分步介紹嗎?

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 所說的基本上是對(duì)的,只是他省略了解釋鏈接器錯(cuò)誤的部分.首先,您需要構(gòu)建您的應(yīng)用程序沒有 CRT 作為運(yùn)行時(shí)庫(kù).無(wú)論如何,您應(yīng)該始終這樣做,因?yàn)樗_實(shí)簡(jiǎn)化了應(yīng)用程序的分發(fā).如果您不這樣做,那么您的所有用戶都需要安裝 Visual C++ 運(yùn)行時(shí)庫(kù),而那些不安裝的用戶會(huì)抱怨他們的系統(tǒng)上缺少神秘的 DLL……因?yàn)殒溄有枰~外花費(fèi)幾百 KB靜態(tài)地使用 CRT,您以后在支持方面會(huì)省去很多麻煩(相信我 - 我已經(jīng)通過艱難的方式學(xué)會(huì)了它!).

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

無(wú)論如何,要做到這一點(diǎn),你去目標(biāo)的屬性 -> C/C++ -> 代碼生成 -> 運(yùn)行時(shí)庫(kù),它需要為你的發(fā)布版本設(shè)置為多線程"和多線程"Debug"用于您的調(diào)試版本.

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 庫(kù)是以相同的方式構(gòu)建的,因此您需要確保鏈接的是 it 的正確版本,否則鏈接器將拉入運(yùn)行時(shí)庫(kù)的另一個(gè)副本,這是您看到的錯(cuò)誤(順便說一句,如果您使用 MFC,這應(yīng)該沒有區(qū)別).您需要將 gtest 構(gòu)建為調(diào)試和發(fā)布模式并保留兩個(gè)副本.然后,您在發(fā)布版本中鏈接 gtest.lib/gtest_main.lib,在調(diào)試版本中鏈接 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.

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

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.

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

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

相關(guān)文檔推薦

How do I set the icon for my application in visual studio 2008?(如何在 Visual Studio 2008 中為我的應(yīng)用程序設(shè)置圖標(biāo)?)
Convert CString to const char*(將 CString 轉(zhuǎn)換為 const char*)
Remove secure warnings (_CRT_SECURE_NO_WARNINGS) from projects by default in Visual Studio(默認(rèn)情況下,在 Visual Studio 中從項(xiàng)目中刪除安全警告 (_CRT_SECURE_NO_WARNINGS))
How do I start a new CUDA project in Visual Studio 2008?(如何在 Visual Studio 2008 中啟動(dòng)新的 CUDA 項(xiàng)目?)
Exporting classes containing `std::` objects (vector, map etc.) from a DLL(從 DLL 導(dǎo)出包含 `std::` 對(duì)象(向量、映射等)的類)
What are some reasons a Release build would run differently than a Debug build(發(fā)布版本與調(diào)試版本的運(yùn)行方式不同的一些原因是什么)
主站蜘蛛池模板: 久久99精品久久久久久 | 中国一级特黄毛片大片 | 婷婷久久网| 中文字幕在线免费 | 日韩一级免费大片 | 成年人在线观看 | 射欧美 | 91免费小视频 | 亚洲入口 | 久久久成人网 | 久久国产视频播放 | 成人二区| 亚洲免费在线观看视频 | 久久美女网 | 97人人爱| 中文欧美日韩 | 成人精品视频在线 | 日韩视频区 | 亚洲午夜精品一区二区三区他趣 | 韩国久久精品 | 国产不卡在线播放 | 日韩有码在线观看 | 国产精品成人av | 久久曰视频 | 午夜精品久久久久久不卡欧美一级 | 成人av一区 | 欧美日韩在线综合 | 91麻豆产精品久久久久久 | 国产精品久久久久aaaa樱花 | 成人免费小视频 | 亚洲综合日韩精品欧美综合区 | 99re视频这里只有精品 | 日韩中文在线观看 | 妹子干综合 | 国产免费播放视频 | 中文字幕一级毛片视频 | 免费一区二区 | 孕妇一级毛片 | 亚洲精品 在线播放 | 337p日本欧洲亚洲大胆精蜜臀 | 免费一区二区三区 |