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

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

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

問題描述

網(wǎng)站上沒有記錄,人們似乎在設(shè)置框架時遇到問題.有人可以展示示例項目設(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 所說的基本上是對的,只是他省略了解釋鏈接器錯誤的部分.首先,您需要構(gòu)建您的應(yīng)用程序沒有 CRT 作為運行時庫.無論如何,您應(yīng)該始終這樣做,因為它確實簡化了應(yīng)用程序的分發(fā).如果您不這樣做,那么您的所有用戶都需要安裝 Visual C++ 運行時庫,而那些不安裝的用戶會抱怨他們的系統(tǒng)上缺少神秘的 DLL……因為鏈接需要額外花費幾百 KB靜態(tài)地使用 CRT,您以后在支持方面會省去很多麻煩(相信我 - 我已經(jīng)通過艱難的方式學(xué)會了它!).

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++ -> 代碼生成 -> 運行時庫,它需要為你的發(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 庫是以相同的方式構(gòu)建的,因此您需要確保鏈接的是 it 的正確版本,否則鏈接器將拉入運行時庫的另一個副本,這是您看到的錯誤(順便說一句,如果您使用 MFC,這應(yīng)該沒有區(qū)別).您需要將 gtest 構(gòu)建為調(diào)試和發(fā)布模式并保留兩個副本.然后,您在發(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)用程序指向存儲 gtest 頭文件的目錄(在屬性 -> C/C++ -> 常規(guī) -> 附加包含目錄中),但如果遇到鏈接器錯誤,我假設(shè)您已經(jīng)設(shè)法使這部分正確,否則您將首先處理更多的編譯器錯誤.

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++ 測試框架 (gtest)的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

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

相關(guān)文檔推薦

How do I set the icon for my application in visual studio 2008?(如何在 Visual Studio 2008 中為我的應(yīng)用程序設(shè)置圖標?)
Convert CString to const char*(將 CString 轉(zhuǎn)換為 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 導(dǎo)出包含 `std::` 對象(向量、映射等)的類)
What are some reasons a Release build would run differently than a Debug build(發(fā)布版本與調(diào)試版本的運行方式不同的一些原因是什么)
主站蜘蛛池模板: 亚洲一区视频在线 | 国产午夜精品久久久 | 欧美另类视频在线 | 日韩欧美综合 | 日韩波多野结衣 | 欧美在线视频一区 | 求个av网址| 污污的网站在线观看 | 日韩欧美精品在线 | 91色啪| 狠狠色综合久久丁香婷婷 | 欧美色综合一区二区三区 | 中文字幕亚洲一区 | 在线天堂免费中文字幕视频 | 97影院在线午夜 | 国产成人a亚洲精品 | 日韩一级欧美一级 | 久久久亚洲成人 | 亚洲国产精品成人综合久久久 | 玖玖国产 | 国产在线a | 这里只有精品99re | 中文字幕精品一区二区三区精品 | 欧美电影免费观看高清 | 亚洲国产精品久久久久久 | 黄色网址在线免费观看 | 亚洲国产aⅴ精品 | 国产网站在线播放 | 久久久久久九九九九九九 | 成人免费视频一区 | 成人在线一区二区三区 | 久久99精品视频 | 国产精品性做久久久久久 | 狠狠干天天干 | 三级视频在线观看 | 欧美日韩免费一区二区三区 | 国产精品2| 精品91久久| 亚洲性人人天天夜夜摸 | 国产精品久久久久久福利一牛影视 | 日韩在线精品强乱中文字幕 |