Dev C++ 標頭檔
Posted By admin On 17.04.20目的檔 9.2 前置處理器 C 語言的前置處理器(Preprocessor)是一個巨集處理器,在編譯器編譯 原始程式之前會自動啟動,主要用來處理C 程式中含有 # 符號開頭的敘 原始程式.c.obj 執行檔.exe Include標頭檔.h 2. 編譯處理(Compiling) 4. 連結處理 (Linking) 1. 例如:C語言的模組或C的類別是由.h標頭檔和.c的程式檔案組 成,我們就可以使用Dev-C的專案來管理模組或類別的程式檔案。 新增Dev-C的專案 Dev-C的專案是一個檔案,其副檔名為.dev,在此檔案記錄應用 程式的相關設定和專案所屬的檔案清單。.
-->從 Visual Studio 建立新項目時,將加入名為pch.h的預寫標頭檔。When you create a new project in Visual Studio, a precompiled header file named pch.h is added to the project.(在 Visual Studio 2017 和更早版本中,該檔稱為stdafx.h.)該檔的目的是加快生成過程。(In Visual Studio 2017 and earlier, the file was called stdafx.h.) The purpose of the file is to speed up the build process.任何穩定的標頭檔(例如標準庫標頭(如<vector>
)都應在此處包含。Any stable header files, for example Standard Library headers such as <vector>
, should be included here.僅當預編譯標頭或其包含的任何檔被修改時,才會編譯它。The precompiled header is compiled only when it, or any files it includes, are modified.如果僅在專案原始程式碼中進行更改,則生成將跳過預編譯標頭的編譯。If you only make changes in your project source code, the build will skip compilation for the precompiled header.
預寫標頭的編譯器選項為/Y。The compiler options for precompiled headers are /Y.在項目屬性頁中,選項位於設定屬性> C/C++>预编译标头。In the project property pages, the options are located under Configuration Properties > C/C++ > Precompiled Headers.您可以選擇不使用預編譯的標頭,也可以指定標頭檔名以及輸出檔的名稱和路徑。You can choose to not use precompiled headers, and you can specify the header file name and the name and path of the output file.
自訂預編譯碼Custom precompiled code
對於需要大量時間構建的大型專案,您可能需要考慮創建自訂預編譯檔。For large projects that take significant time to build, you may want to consider creating custom precompiled files.Microsoft C 和 C++ 編譯器提供對任何 C 或 C++ 程式碼進行先行編譯的選項,包括內嵌程式碼。The Microsoft C and C++ compilers provide options for precompiling any C or C++ code, including inline code.您可以使用這項效能功能來編譯穩定的程式碼主體,並將程式碼的編譯狀態儲存在檔案中,然後在後續編譯期間,將先行編譯的程式碼與仍在開發中的程式碼結合。Using this performance feature, you can compile a stable body of code, store the compiled state of the code in a file, and, during subsequent compilations, combine the precompiled code with code that is still under development.由於穩定的程式碼不需要重新編譯,因此每個後續編譯的速度會更快。Each subsequent compilation is faster because the stable code does not need to be recompiled.
先行編譯原始程式碼的時機When to Precompile Source Code
預編譯代碼在開發週期中非常有用,用於縮短編譯時間,尤其是在以下情況:Precompiled code is useful during the development cycle to reduce compilation time, especially if:
您始終使用不常更改的大量代碼。You always use a large body of code that changes infrequently.
您的程式包含多個模組,所有這些模組都使用一組標準的包含檔和相同的編譯選項。Your program comprises multiple modules, all of which use a standard set of include files and the same compilation options.在這種情況下,所有包含檔都可以預編譯為一個預編譯標頭。In this case, all include files can be precompiled into one precompiled header.
第一個編譯(創建預編譯標頭 (PCH) 檔)比後續編譯長一點。The first compilation — the one that creates the precompiled header (PCH) file — takes a bit longer than subsequent compilations.通過包括預編譯的代碼,後續編譯可以更快地進行。Subsequent compilations can proceed more quickly by including the precompiled code.
您可以預編譯 C 和C++程式。You can precompile both C and C++ programs.在C++程式設計中,通常的做法是將類介面資訊分離到頭檔中。In C++ programming, it is common practice to separate class interface information into header files.這些標頭檔以後可以包含在使用類的程式中。These header files can later be included in programs that use the class.通過預編譯這些標頭,可以減少程式編譯所需的時間。By precompiling these headers, you can reduce the time a program takes to compile.
注意
儘管每個源檔只能使用一個預編譯的標頭 (.pch) 檔,但可以在專案中使用多個 .pch 檔。Although you can use only one precompiled header (.pch) file per source file, you can use multiple .pch files in a project.
先行編譯程式碼的兩個選擇Two Choices for Precompiling Code
您可以預編譯任何 C 或C++代碼;您不限於僅預編譯標頭檔。You can precompile any C or C++ code; you are not limited to precompiling only header files.
預編譯需要規劃,但如果預編譯簡單標頭檔以外的原始程式碼,則預編譯速度會明顯加快。Precompiling requires planning, but it offers significantly faster compilations if you precompile source code other than simple header files.
當您知道原始碼使用常用的標頭檔集,但不按相同的順序包括它們,或者當您希望在預編譯中包括原始碼時,請預編譯代碼。Precompile code when you know that your source files use common sets of header files but don't include them in the same order, or when you want to include source code in your precompilation.
預編譯標頭選項為/Yc(創建預編譯的標頭檔)和/Yu(使用預編譯的標頭檔)。The precompiled-header options are /Yc (Create Precompiled Header File) and /Yu (Use Precompiled Header File).使用 /Yc創建預編譯標頭。Use /Yc to create a precompiled header.當與可選的hdrstop實用素一起使用時 ,/Yc允許您預編譯標頭檔和原始程式碼。When used with the optional hdrstop pragma, /Yc lets you precompile both header files and source code.選擇 /Yu以在現有編譯中使用現有的預編譯標頭。Select /Yu to use an existing precompiled header in the existing compilation.您還可以使用 /Fp與 /Yc和 /Yu選項一起為預編譯標頭提供替代名稱。You can also use /Fp with the /Yc and /Yu options to provide an alternative name for the precompiled header.
/Yu和 /Yc的編譯器選項參考主題討論如何在開發環境中存取此功能。The compiler option reference topics for /Yu and /Yc discuss how to access this functionality in the development environment.
先行編譯標頭的一致性規則Precompiled Header Consistency Rules
由於 PCH 檔包含有關電腦環境的資訊以及有關該程式的記憶體位址資訊,因此應僅在創建該程式的電腦上使用 PCH 檔。Because PCH files contain information about the machine environment as well as memory address information about the program, you should only use a PCH file on the machine where it was created.
針對每個檔案使用的先行編譯標頭的一致性規則Consistency Rules for Per-File Use of Precompiled Headers
/Yu編譯器選項允許您指定要使用的 PCH 檔。The /Yu compiler option lets you specify which PCH file to use.
使用 PCH 檔時,編譯器將假定在創建 PCH 檔時有效的編譯環境(使用一致的編譯器選項、雜注等)有效,除非您另有說明。When you use a PCH file, the compiler assumes the same compilation environment — one that uses consistent compiler options, pragmas, and so on — that was in effect when you created the PCH file, unless you specify otherwise.如果編譯器檢測到不一致,它會發出警告,並儘可能識別不一致。If the compiler detects an inconsistency, it issues a warning and identifies the inconsistency where possible.此類警告不一定表示 PCH 檔有問題;因此,這些警告並不一定表示 PCH 檔存在問題。他們只是警告你潛在的衝突。Such warnings do not necessarily indicate a problem with the PCH file; they simply warn you of possible conflicts.PCH檔的一致性要求如下所述。Consistency requirements for PCH files are described in the following sections.
編譯器選項一致性Compiler Option Consistency
使用 PCH 檔時,以下編譯器選項可能會觸發不一致警告:The following compiler options can trigger an inconsistency warning when using a PCH file:
使用預處理器 (/D) 選項創建的巨集在創建 PCH 檔和當前編譯的編譯之間必須相同。Macros created using the Preprocessor (/D) option must be the same between the compilation that created the PCH file and the current compilation.未檢查已定義的常量的狀態,但如果更改這些常量,則可能會出現不可預知的結果。The state of defined constants is not checked, but unpredictable results can occur if these change.
PCH 檔案不適用於 /E 和 /EP 選項。PCH files do not work with the /E and /EP options.
在使用 PCH 檔的後續編譯可以使用這些選項之前,必須使用生成瀏覽資訊 (/FR) 選項或排除局部變數 (/Fr) 選項創建 PCH 檔。PCH files must be created using either the Generate Browse Info (/FR) option or the Exclude Local Variables (/Fr) option before subsequent compilations that use the PCH file can use these options.
Izotope vocalsynth 2 autotune. Vocal Bundle. The Vocal Bundle combines two inspiring vocal tools into one powerhouse package. Give your vocal a radio-ready sheen with Nectar 3's surgical polishing, and enter uncharted creative territory with VocalSynth 2's wealth of effects.
C 7.0 相容 (/Z7)C 7.0-Compatible (/Z7)
如果此選項在創建 PCH 檔時有效,則使用 PCH 檔的後續編譯可以使用調試資訊。If this option is in effect when the PCH file is created, subsequent compilations that use the PCH file can use the debugging information.
如果在創建 PCH 檔時 C 7.0 相容 (/Z7) 選項無效,則使用 PCH 檔和 /Z7 的後續編譯將觸發警告。If the C 7.0-Compatible (/Z7) option is not in effect when the PCH file is created, subsequent compilations that use the PCH file and /Z7 trigger a warning.除錯資訊放置在目前的 .obj 檔中,並且在 PCH 檔中定義的本地符號對除錯器不可用。The debugging information is placed in the current .obj file, and local symbols defined in the PCH file are not available to the debugger.
包括路徑一致性Include Path Consistency
PCH 檔不包含有關建立時有效的包含路徑的資訊。A PCH file does not contain information about the include path that was in effect when it was created.使用 PCH 檔時,編譯器始終使用當前編譯中指定的包含路徑。When you use a PCH file, the compiler always uses the include path specified in the current compilation.
來源檔案一致性Source File Consistency
指定「使用預編譯標頭檔 (/Yu)」選項時,編譯器將忽略將預編譯的原始程式碼中顯示的所有預處理器指令(包括雜註)。When you specify the Use Precompiled Header File (/Yu) option, the compiler ignores all preprocessor directives (including pragmas) that appear in the source code that will be precompiled.此類預處理器指令指定的編譯必須與創建預編譯標頭檔 (/Yc) 選項的編譯相同。The compilation specified by such preprocessor directives must be the same as the compilation used for the Create Precompiled Header File (/Yc) option.
實用一致性Pragma Consistency
在創建 PCH 檔期間處理的實用主義通常會影響隨後使用 PCH 檔的檔。Pragmas processed during the creation of a PCH file usually affect the file with which the PCH file is subsequently used.和comment``message
雜注不會影響編譯的其餘部分。The comment
and message
pragmas do not affect the remainder of the compilation.
這些雜注僅影響 PCH 檔中的代碼;它們不會影響隨後使用 PCH 檔案的代碼:These pragmas affect only the code within the PCH file; they do not affect code that subsequently uses the PCH file:
comment | page | subtitle |
linesize | pagesize | title |
message | skip |
這些雜注作為預編譯標頭的一部分保留,並影響使用預編譯標頭的編譯的其餘部分:These pragmas are retained as part of a precompiled header, and affect the remainder of a compilation that uses the precompiled header:
alloc_text | include_alias | pack |
auto_inline | init_seg | pointers_to_members |
check_stack | inline_depth | setlocale |
code_seg | inline_recursion | vtordisp |
data_seg | intrinsic | warning |
function | optimize |
/Yc 和 /Yu 的一致性規則Consistency Rules for /Yc and /Yu
使用使用 /Yc 或 /Yu 創建的預編譯標頭時,編譯器會將當前編譯環境與創建 PCH 檔時存在的編譯環境進行比較。When you use a precompiled header created using /Yc or /Yu, the compiler compares the current compilation environment to the one that existed when you created the PCH file.請確保為當前編譯指定與前一個環境一致的環境(使用一致的編譯器選項、雜注等)。Be sure to specify an environment consistent with the previous one (using consistent compiler options, pragmas, and so on) for the current compilation.如果編譯器檢測到不一致,它會發出警告,並儘可能識別不一致。If the compiler detects an inconsistency, it issues a warning and identifies the inconsistency where possible.此類警告不一定表示 PCH 檔有問題;因此,這些警告並不一定表示 PCH 檔存在問題。他們只是警告你潛在的衝突。Such warnings don't necessarily indicate a problem with the PCH file; they simply warn you of possible conflicts.以下各節解釋預編譯標頭的一致性要求。The following sections explain the consistency requirements for precompiled headers.
編譯器選項一致性Compiler Option Consistency
此表列出了在使用預編譯標頭時可能引發不一致警告的編譯器選項:This table lists compiler options that might trigger an inconsistency warning when using a precompiled header:
選項Option | 名稱Name | 規則Rule |
---|---|---|
/D/D | 定義常量和巨集Define constants and macros | 創建預編譯標頭的編譯和當前編譯之間必須相同。Must be the same between the compilation that created the precompiled header and the current compilation.未檢查已定義的常量的狀態,但如果文件依賴於更改的常量的值,則可能會出現不可預知的結果。The state of defined constants is not checked, but unpredictable results can occur if your files depend on the values of the changed constants. |
/E 或 /EP/E or /EP | 將預處理器輸出複製到標準輸出Copy preprocessor output to standard output | 預編譯標頭不適用於 /E 或 /EP 選項。Precompiled headers do not work with the /E or /EP option. |
/Fr 或 /FR/Fr or /FR | 產生微軟源瀏覽器資訊Generate Microsoft Source Browser information | 對於 /Fr 和 /FR 選項在 /Yu 選項中有效,它們也必須在創建預編譯標頭時有效。For the /Fr and /FR options to be valid with the /Yu option, they must also have been in effect when the precompiled header was created.使用預編譯標頭的後續編譯也會生成源瀏覽器資訊。Subsequent compilations that use the precompiled header also generate Source Browser information.瀏覽器資訊放置在單個 .sbr 檔中,其他檔以與 CodeView 資訊相同的方式引用這些資訊。Browser information is placed in a single .sbr file and is referenced by other files in the same manner as CodeView information.您不能覆蓋源瀏覽器資訊的位置。You cannot override the placement of Source Browser information. |
/GA、/GD、/GE、/Gw 或 /GW/GA, /GD, /GE, /Gw, or /GW | Windows 協定選項Windows protocol options | 創建預編譯標頭的編譯和當前編譯之間必須相同。Must be the same between the compilation that created the precompiled header and the current compilation.如果這些選項不同,則會生成警告消息。If these options differ, a warning message results. |
/ZI/Zi | 產生完整的除錯資訊Generate complete debugging information | 如果此選項在創建預編譯標頭時有效,則使用預編譯的後續編譯可以使用該調試資訊。If this option is in effect when the precompiled header is created, subsequent compilations that use the precompilation can use that debugging information.如果在創建預編譯標頭時 /Zi 無效,則使用預編譯和 /Zi 選項的後續編譯將觸發警告。If /Zi is not in effect when the precompiled header is created, subsequent compilations that use the precompilation and the /Zi option trigger a warning.除錯資訊放置在目前的物件檔中,並且在預編譯標頭中定義的本機號對除錯器不可用。The debugging information is placed in the current object file, and local symbols defined in the precompiled header are not available to the debugger. |
注意
預編譯標頭工具僅用於 C 和 C++源檔。The precompiled header facility is intended for use only in C and C++ source files.
在專案中使用先行編譯的標頭Using Precompiled Headers in a Project
前面的各節概述了預編譯標頭:/Yc 和 /Yu、/Fp 選項和hdrstop雜注。Previous sections present an overview of precompiled headers: /Yc and /Yu, the /Fp option, and the hdrstop pragma.本節介紹在專案中使用手動預編譯標頭選項的方法;它以一個範例 makefile 及其管理的代碼結束。This section describes a method for using the manual precompiled-header options in a project; it ends with an example makefile and the code that it manages.
對於在專案中使用手動預編譯標頭選項的另一種方法,請研究在 Visual Studio 的預設設定期間創建的 MFC_SRC 目錄中的一個 makefile。For another approach to using the manual precompiled-header options in a project, study one of the makefiles located in the MFCSRC directory that is created during the default setup of Visual Studio.這些 makefile 採用與本節中介紹的方法類似的方法,但更多地利用了 Microsoft 程式維護實用程式 (NMAKE) 宏,並更好地控制了生成過程。These makefiles take a similar approach to the one presented in this section but make greater use of Microsoft Program Maintenance Utility (NMAKE) macros, and offer greater control of the build process.
建置程序中的 PCH 檔PCH Files in the Build Process
軟體項目的代碼庫通常包含在多個 C 或 C++源檔、物件檔、庫和標頭檔中。The code base of a software project is usually contained in multiple C or C++ source files, object files, libraries, and header files.通常,makefile 將這些元素組合為可執行檔。Typically, a makefile coordinates the combination of these elements into an executable file.下圖顯示了使用預編譯標頭檔的 makefile 的結構。The following figure shows the structure of a makefile that uses a precompiled header file.此關係圖中的 NMAKE 宏名和檔名與PCH 範例 Makefile和PCH 範例代碼中的範例代碼中的那些名稱一致。The NMAKE macro names and the file names in this diagram are consistent with those in the example code found in Sample Makefile for PCH and Example Code for PCH.
該圖使用三個圖表設備來顯示生成過程的流。The figure uses three diagrammatic devices to show the flow of the build process.命名矩形表示每個檔或宏;三個宏表示一個或多個檔。Named rectangles represent each file or macro; the three macros represent one or more files.已對區域表示每個編譯或連結操作。Shaded areas represent each compile or link action.箭號顯示在編譯或連結過程中組合的文件和宏。Arrows show which files and macros are combined during the compilation or linking process.
使用預編譯標頭檔案的 Makefile 的結構Structure of a Makefile That Uses a Precompiled Header File
從關係圖的頂部開始,STABLEHDRS 和 BOUNDRY 都是 NMAKE 宏,其中列出了不需要重新編譯的檔。Beginning at the top of the diagram, both STABLEHDRS and BOUNDRY are NMAKE macros in which you list files not likely to need recompilation.這些檔案由命令字串編譯These files are compiled by the command string
CL /c /W3 /Yc$(BOUNDRY) applib.cpp myapp.cpp
僅當預編譯的標頭檔 (STABLE.pch) 不存在或對兩個巨集中列出的檔進行更改時。only if the precompiled header file (STABLE.pch) does not exist or if you make changes to the files listed in the two macros.在這兩種情況下,預編譯的標頭檔將僅包含來自 STABLEHDRS 宏中列出的檔的代碼。In either case, the precompiled header file will contain code only from the files listed in the STABLEHDRS macro.列出要在 BOUNDRY 宏中預編譯的最後一個檔。List the last file you want precompiled in the BOUNDRY macro.
在這些宏中列出的檔可以是標頭檔或 C 或 C++原始檔。The files you list in these macros can be either header files or C or C++ source files.(單個 PCH 檔不能同時用於 C 和 C++ 模組。請注意,您可以使用hdrstop宏在 BOUNDRY 檔中的某個點停止預編譯。(A single PCH file cannot be used with both C and C++ modules.) Note that you can use the hdrstop macro to stop precompilation at some point within the BOUNDRY file.有關詳細資訊,請參閱hdrstop。See hdrstop for more information.
APPLIB.obj 繼續向下表示最終應用程式中使用的支援代碼。Continuing down the diagram, APPLIB.obj represents the support code used in your final application.它創建自 APPLIB.cpp,UNSTABLEHDRS 宏中列出的檔,並從預編譯標頭中預編譯代碼。It is created from APPLIB.cpp, the files listed in the UNSTABLEHDRS macro, and precompiled code from the precompiled header.
MYAPP.obj 代表您的最終申請。MYAPP.obj represents your final application.它創建於 MYAPP.cpp,即 UNSTABLEHDRS 宏中列出的檔,並從預編譯標頭中預編譯代碼。It is created from MYAPP.cpp, the files listed in the UNSTABLEHDRS macro, and precompiled code from the precompiled header.
最後,可執行檔(MYAPP)。EXE)是通過連結 OBJS 宏(APPLIB.obj 和 MYAPP.obj)中列出的文件創建的。Finally, the executable file (MYAPP.EXE) is created by linking the files listed in the OBJS macro (APPLIB.obj and MYAPP.obj).
PCH 的 Makefile 範例Sample Makefile for PCH
Dev C++ For Windows 10
以下 makefile 使用巨集與 !如果!還!ENDIF 控制流命令結構,以簡化其對項目的適應。The following makefile uses macros and an !IF, !ELSE, !ENDIF flow-of-control command structure to simplify its adaptation to your project.
除了生成過程中 PCH 檔中的「使用預編譯的標頭檔的 Makefile 的結構」中所示的 STABLEHDRS、BOUNDRY 和 UNSTABLEHDRS 宏外,此 makefile 提供了 CLFLAGS 宏和 LINKFLAGS 宏。Aside from the STABLEHDRS, BOUNDRY, and UNSTABLEHDRS macros shown in the figure 'Structure of a Makefile That Uses a Precompiled Header File' in PCH Files in the Build Process, this makefile provides a CLFLAGS macro and a LINKFLAGS macro.您必須使用這些宏來列出編譯器和連結器選項,這些選項適用於生成應用程式的可執行檔的調試版本還是最終版本。You must use these macros to list compiler and linker options that apply whether you build a debug or final version of the application's executable file.還有一個 LIBS 宏,您可以在其中列出專案所需的庫。There is also a LIBS macro where you list the libraries your project requires.
Dev C 標頭檔 Youtube
makefile 也使用 。如果!還!ENDIF 用於偵測您是否在 NMAKE 命令列上定義 DEBUG 符號:The makefile also uses !IF, !ELSE, !ENDIF to detect whether you define a DEBUG symbol on the NMAKE command line:
Dev C++ 5.11
此功能使您能夠在開發和程式的最終版本中使用相同的 makefile - 將 DEBUG_0 用於最終版本。This feature makes it possible for you to use the same makefile during development and for the final versions of your program — use DEBUG=0 for the final versions.以下命令列等效:The following command lines are equivalent:
有關製作檔案的詳細資訊,請參閱NMAKE 參考。For more information on makefiles, see NMAKE Reference.另請參考MSVC 編譯器選項與MSVC 連結器選項。Also see MSVC Compiler Options and the MSVC Linker Options.
PCH 範例程式碼Example Code for PCH
以下來源檔用於生成過程中 PCH 檔中描述的 makefile 和PCH 的「範例使檔案」。The following source files are used in the makefile described in PCH Files in the Build Process and Sample Makefile for PCH.請注意,註釋包含重要資訊。Note that the comments contain important information.
另請參閱See also
C/C++ 建置參考C/C++ Building Reference
MSVC 編譯器選項MSVC Compiler Options
Dev C 標頭檔 Online
-->許多類型的檔案都與傳統桌面應用程式的 Visual Studio 專案相關聯。Many types of files are associated with Visual Studio projects for classic desktop applications.您的專案中包含的實際檔案取決於專案類型以及您使用精靈時選取的選項。The actual files included in your project depend on the project type and the options you select when using a wizard.
當您建立 Visual Studio 專案時,您可以在新的方案中建立它,也可以將專案加入現有的方案中。When you create a Visual Studio project, you might create it in a new solution, or you might add a project to an existing solution.非一般應用程式通常是與方案中的多個專案一起開發。Non-trivial applications are commonly developed with multiple projects in a solution.
專案通常會產生 EXE 或 DLL。Projects usually produce either an EXE or a DLL.專案可以彼此相依;在建立過程中,Visual Studio 環境會檢查項目內和之間的相依性。Projects can be dependent on each other; during the build process, the Visual Studio environment checks dependencies both within and between projects.每個專案通常都有核心原始程式碼。Each project usually has core source code.視專案類型而定,可能會有許多其他檔案包含專案的各個層面。Depending on the kind of project, it may have many other files containing various aspects of the project.這些檔案的內容會以副檔名表示。The contents of these files are indicated by the file extension.Visual Studio 開發環境使用副檔名來決定如何在建置期間處理檔案內容。The Visual Studio development environment uses the file extensions to determine how to handle the file contents during a build.
下表顯示 Visual Studio 專案中的一般檔案,並以其副檔名加以識別。The following table shows common files in a Visual Studio project, and identifies them with their file extension.
副檔名File extension | 類型Type | 內容Contents |
---|---|---|
.asmx.asmx | 來源Source | 部署檔案。Deployment file. |
.asp.asp | 來源Source | Active Server Page 檔。Active Server Page file. |
.atp.atp | 隨附此逐步解說的專案Project | 應用程式範本專案檔。Application template project file. |
.bmp、.dib、.gif、.jpg、.jpe、.png.bmp, .dib, .gif, .jpg, .jpe, .png | 資源Resource | 一般影像檔。General image files. |
.bsc.bsc | 編譯Compiling | 瀏覽器程式碼檔。The browser code file. |
.cpp、。c.cpp, .c | 來源Source | 您的應用程式的主要原始程式碼檔。Main source code files for your application. |
.cur.cur | 資源Resource | 資料指標點陣圖形檔。Cursor bitmap graphic file. |
.dbp.dbp | 隨附此逐步解說的專案Project | 資料庫專案檔。Database project file. |
.disco.disco | 來源Source | 動態探索文件檔。The dynamic discovery document file.處理 XML Web 服務探索。Handles XML Web service discovery. |
.exe、.dll.exe, .dll | 隨附此逐步解說的專案Project | 可執行檔或動態連結程式庫檔。Executable or dynamic-link library files. |
.h.h | 來源Source | 標頭 (Include) 檔。A header (include) file. |
.htm、.html、.xsp、.asp、.htc、.hta、.xml.htm, .html, .xsp, .asp, .htc, .hta, .xml | 資源Resource | 一般 Web 檔案。Common Web files. |
.HxC.HxC | 隨附此逐步解說的專案Project | 說明專案檔。Help project file. |
.ico.ico | 資源Resource | 圖示點陣圖形檔。Icon bitmap graphic file. |
.idb.idb | 編譯Compiling | 狀態檔案,其中包含來源檔案與類別定義之間的相依性資訊。The state file, containing dependency information between source files and class definitions.編譯器可在累加式編譯期間使用它。It can be used by the compiler during incremental compilation.使用 /Fd 編譯器選項以指定 .idb 檔的名稱。Use the /Fd compiler option to specify the name of the .idb file. |
.idl.idl | 編譯Compiling | 介面定義語言檔。An interface definition language file.如需詳細資訊,請參閱 Windows SDK 中的 Interface Definition (IDL) File (介面定義 (IDL) 檔)。For more information, see Interface Definition (IDL) File in the Windows SDK. |
.ilk.ilk | 連結Linking | 累加連結檔案。Incremental link file.如需詳細資訊,請參閱/INCREMENTAL。For more information, see /INCREMENTAL. |
.map.map | 連結Linking | 包含連結器資訊的文字檔。A text file containing linker information.使用 /Fm 編譯器選項來命名對應檔。Use the /Fm compiler option to name the map file.如需詳細資訊,請參閱/MAP。For more information, see /MAP. |
.mfcribbon-ms.mfcribbon-ms | 資源Resource | 資源檔,其中包含定義功能區中 MFC 按鈕、控制項和屬性的 XML 程式碼。A resource file that contains the XML code that defines the MFC buttons, controls, and attributes in the ribbon.如需詳細資訊,請參閱 Ribbon Designer。For more information, see Ribbon Designer. |
.obj、.o.obj, .o | 目的檔,已編譯但尚未連結。Object files, compiled but not linked. | |
.pch.pch | 偵錯Debug | 先行編譯標頭檔。Precompiled header file. |
.rc、.rc2.rc, .rc2 | 資源Resource | 用以產生資源的資源指令碼檔 。Resource script files to generate resources. |
.sbr.sbr | 編譯Compiling | 原始程式瀏覽器中繼檔案。Source browser intermediate file.BSCMAKE的輸入檔。The input file for BSCMAKE. |
.sln.sln | 解決方法Solution | 「方案」檔。The solution file. |
.suo.suo | 解決方法Solution | 方案選項檔。The solution options file. |
.txt.txt | 資源Resource | 文字檔,通常是「讀我」檔案。A text file, usually the 'readme' file. |
.vap.vap | 隨附此逐步解說的專案Project | Visual Studio Analyzer 專案檔。A Visual Studio Analyzer project file. |
.vbg.vbg | 解決方法Solution | 相容專案群組檔。A compatible project group file. |
.vbp、.vip、.vbproj.vbp, .vip, .vbproj | 隨附此逐步解說的專案Project | Visual Basic 專案檔。The Visual Basic project file. |
.vcxitems.vcxitems | 隨附此逐步解說的專案Project | 用於在多個 C++ 專案之間共用程式碼檔的共用項目專案。Shared Items project for sharing code files between multiple C++ projects.如需詳細資訊,請參閱專案和方案檔。For more information, see Project and Solution Files. |
.vcxproj.vcxproj | 隨附此逐步解說的專案Project | Visual Studio 專案檔案。The Visual Studio project file.如需詳細資訊,請參閱專案和方案檔。For more information, see Project and Solution Files. |
.vcxproj.filters.vcxproj.filters | 隨附此逐步解說的專案Project | 當您使用方案總管將檔案新增至專案時使用。Used when you use Solution Explorer to add a file to a project.篩選檔案會根據檔案的副檔名,定義要在方案總管樹狀檢視中新增檔案的位置。The filters file defines where in the Solution Explorer tree view to add the file, based on its file name extension. |
.vdproj.vdproj | 隨附此逐步解說的專案Project | Visual Studio 部署專案檔。The Visual Studio deployment project file. |
.vmx.vmx | 隨附此逐步解說的專案Project | 巨集專案檔。The macro project file. |
.vup.vup | 隨附此逐步解說的專案Project | 公用程式專案檔。The utility project file. |
如需與 Visual Studio 相關聯之其他檔案的相關資訊,請參閱 Visual Studio .NET 中的檔案類型與副檔名。For information on other files associated with Visual Studio, see File Types and File Extensions in Visual Studio .NET.
專案檔會組織成方案總管中的資料夾。Project files are organized into folders in Solution Explorer.Visual Studio 會建立原始程式檔、標頭檔和資源檔的資料夾,但您可以重新組織這些資料夾或建立新的資料夾。Visual Studio creates a folder for source files, header files, and resource files, but you can reorganize these folders or create new ones.您可以使用資料夾在專案階層內明確地組織檔案邏輯叢集。You can use folders to organize explicitly logical clusters of files within the hierarchy of a project.例如,您可以建立資料夾來包含所有的使用者介面來源檔案。For example, you could create folders to contain all your user interface source files.或者,適用于規格、檔或測試套件的資料夾。Or, folders for specifications, documentation, or test suites.所有的檔案資料夾名稱必須是唯一的。All file folder names should be unique.
當您將專案加入至專案時,會將專案加入至該專案的所有設定。When you add an item to a project, you add the item to all configurations for that project.會加入專案,不論其是否為可建置。The item is added whether it's buildable or not.例如,如果您有名稱為 MyProject 的專案,加入項目會將其加入偵錯和發行專案組態。For example, if you have a project named MyProject, adding an item adds it to both the Debug and Release project configurations.
另請參閱See also
建立和管理 Visual Studio C++專案Creating and Managing Visual Studio C++ Projects
Visual Studio C++專案類型Visual Studio C++ Project Types