久久久久久久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青青草视频 | 欧美在线亚洲 | 成人在线电影在线观看 | 久久国产精品免费一区二区三区 | 亚洲精品欧美 | 欧美在线国产精品 | 国产精品夜夜春夜夜爽久久电影 | 北条麻妃一区二区三区在线视频 | 午夜久久久久久久久久一区二区 | 影音先锋欧美资源 | 日韩av一区二区在线观看 | 一区二区精品 | 欧美综合色 | 一区二区三区四区不卡 | 污视频在线免费观看 | 九九热这里 | 三级在线观看 | 韩国精品一区二区三区 | 欧美一区二区在线观看 | 91精品国产一区二区 | 第一色在线 | 超碰高清| 精品久久国产老人久久综合 | 亚洲视频一区在线 | 伊人久久大香线 | 在线观看视频福利 | 亚洲高清视频在线 | 国产精品高潮呻吟久久av野狼 | 久久黄色精品视频 | 九色在线观看 | 国产一区二区三区视频免费观看 | 91av小视频| 日韩高清一区 | 久久精品一区二区 | 日韩欧美操 | 97免费视频在线观看 | 国产一区二区三区不卡av | 亚洲精品自在在线观看 |