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

#include 所有 .cpp 文件到一個編譯單元?

#include all .cpp files into a single compilation unit?(#include 所有 .cpp 文件到一個編譯單元?)
本文介紹了#include 所有 .cpp 文件到一個編譯單元?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

我最近有理由使用通常的調試和發布配置以及我以前從未見過的全部發布"和全部調試"來處理一些 Visual Studio C++ 項目.

I recently had cause to work with some Visual Studio C++ projects with the usual Debug and Release configurations, but also 'Release All' and 'Debug All', which I had never seen before.

事實證明,項目的作者有一個 ALL.cpp,其中 #includes 所有其他 .cpp 文件.*All 配置只是構建這個 ALL.cpp 文件.它當然被排除在常規配置之外,常規配置不構建ALL.cpp

It turns out the author of the projects has a single ALL.cpp which #includes all other .cpp files. The *All configurations just build this one ALL.cpp file. It is of course excluded from the regular configurations, and regular configurations don't build ALL.cpp

我只是想知道這是否是一種常見做法?它帶來什么好處?(我的第一反應是它聞起來很糟糕.)

I just wondered if this was a common practice? What benefits does it bring? (My first reaction was that it smelled bad.)

您可能會遇到哪些陷阱?我能想到的一個問題是,如果您的 .cpps 中有匿名命名空間,它們不再是該 cpp 的私有"名稱,但現在在其他 cpp 中也可見?

What kinds of pitfalls are you likely to encounter with this? One I can think of is if you have anonymous namespaces in your .cpps, they're no longer 'private' to that cpp but now visible in other cpps as well?

所有項目都構建 DLL,所以在匿名命名空間中保存數據不是一個好主意,對吧?但是功能就可以了嗎?

All the projects build DLLs, so having data in anonymous namespaces wouldn't be a good idea, right? But functions would be OK?

推薦答案

它被一些人(和 google-able)稱為Unity Build".它的鏈接速度非???,編譯速度也相當快.它非常適合您不需要迭代的構建,例如來自中央服務器的發布構建,但不一定適用于增量構建.

It's referred to by some (and google-able) as a "Unity Build". It links insanely fast and compiles reasonably quickly as well. It's great for builds you don't need to iterate on, like a release build from a central server, but it isn't necessarily for incremental building.

這是一個需要維護的 PITA.

And it's a PITA to maintain.

這是獲取更多信息的第一個谷歌鏈接:http://buffered.io/posts/the-magic-of-unity-builds/

here's the first google link for more info: http://buffered.io/posts/the-magic-of-unity-builds/

使其快速的原因是編譯器只需要讀入所有內容,編譯出來,然后鏈接,而不是對每個 .cpp 文件都這樣做.

The thing that makes it fast is that the compiler only needs to read in everything once, compile out, then link, rather than doing that for every .cpp file.

Bruce Dawson 在他的博客上寫得更好:http://randomascii.wordpress.com/2014/03/22/make-vc-compiles-fast-through-parallel-compilation/

Bruce Dawson has a much better write up about this on his blog: http://randomascii.wordpress.com/2014/03/22/make-vc-compiles-fast-through-parallel-compilation/

這篇關于#include 所有 .cpp 文件到一個編譯單元?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持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(發布版本與調試版本的運行方式不同的一些原因是什么)
主站蜘蛛池模板: 91视频在线观看 | 国产一区二区电影 | 在线91| 久久久av | 中文字幕在线视频免费观看 | 中文字幕av在线播放 | 国产精品久久精品 | 天天躁日日躁狠狠很躁 | 久久涩涩 | 久久精品一区 | 欧美视频一区二区三区 | 国产精品18hdxxxⅹ在线 | 久久美女视频 | 成人毛片在线观看 | 日本中文字幕视频 | 国产精品99久久久久久人 | 日韩成人在线观看 | 亚洲一区二区在线播放 | 欧美一区在线视频 | 81精品国产乱码久久久久久 | 最新中文字幕一区 | 国产成人一区二区三区精 | 欧美手机在线 | 日韩av在线免费 | 在线āv视频 | 一区二区日韩 | 亚洲一二三区精品 | 性欧美xxxx | 免费看国产一级特黄aaaa大片 | 爽爽免费视频 | 亚洲成人免费 | 欧美在线观看一区二区 | 色婷婷综合久久久中字幕精品久久 | 成人福利电影 | 国产成人精品久久二区二区91 | 欧美一区二区三区 | 国产在线h | 91麻豆精品国产91久久久更新资源速度超快 | 精品久久国产 | 国产精品久久久久久久久久久久冷 | 黄色毛片一级 |