📄 c-builder2.html
字号:
<p class="listspace"><ul class="Bullet" type="disc"><li><a name="86205"> </a>Project source code files, which are added to the project by the user.</li></ul></p><p class="listspace"><ul class="Bullet" type="disc"><li><a name="86206"> </a>An <b class="guiLabel"><font face="Helvetica, sans-serif" size="-1" class="sans">Object Modules</font></b> folder, which contains a list of objects that the project's build will produce. The list is automatically generated by the project facility.</li></ul></p><p class="listspace"><ul class="Bullet" type="disc"><li><a name="86207"> </a>An <b class="guiLabel"><font face="Helvetica, sans-serif" size="-1" class="sans">External Dependencies</font></b> folder, which contains a list of <b class="command">make</b> dependencies. The list is automatically generated by the project facility.</li></ul></p></dl><dl class="margin"><dd><p class="Body"><a name="105402"> </a>Initially, there are only the default folders for <b class="guiLabel"><font face="Helvetica, sans-serif" size="-1" class="sans">Built Objects</font></b> and <b class="guiLabel"><font face="Helvetica, sans-serif" size="-1" class="sans">External Dependencies</font></b>, and the <i class="textVariable">projectName</i><b class="file">.out </b>file. The file <i class="textVariable">projectName</i><b class="file">.out</b> is created as a single, partially-linked module when the project is built. It comprises all of the individual object modules in a project for a downloadable application, and provides for downloading them all to the target simultaneously.</p></dl></dl><dl class="margin"><dd><p class="table" callout><table border="0" cellpadding="0" cellspacing="0"><tr valign="top"><td valign="top" width="40"><br><img border="0" alt="*" src="icons/warning.gif"></td><td><hr><div class="CalloutCell"><a name="105429"><b class="symbol_UC"><font face="Helvetica, sans-serif" size="-1" class="sans">WARNING: </font></b></a>Use of the <i class="textVariable">projectName</i><b class="file">.out </b>file is essential for downloading C++ modules, which require munching for proper static constructor initialization. You should also use the <i class="textVariable">projectName</i><b class="file">.out </b>file for downloading C modules to avoid any potential link order issues related to dynamic loading and linking.</div></td></tr><tr valign="top"><td></td><td><hr></td></tr><tr valign="middle"><td colspan="20"></td></tr></table></p callout></dl><font face="Helvetica, sans-serif" class="sans"><h4 class="H4"><i><a name="85173">Creating, Adding, and Removing Application Files</a></i></h4></font><dl class="margin"><dl class="margin"><dd><p class="Body"><a name="99724"> </a>To create a new file, click <b class="guiLabel"><font face="Helvetica, sans-serif" size="-1" class="sans">File</font></b>><b class="guiLabel"><font face="Helvetica, sans-serif" size="-1" class="sans">New</font></b>, or press <kbd>CTRL+N</kbd>. Select the file type from the <b class="guiLabel"><font face="Helvetica, sans-serif" size="-1" class="sans">New</font></b> dialog box. Then select the project to which the file should be added. Finally, enter the file name and directory, and click <b class="guiLabel"><font face="Helvetica, sans-serif" size="-1" class="sans">OK</font></b> (<a href="c-builder2.html#100052">Figure 4-9</a>). The editor window opens, and you can write your code and save the file. (See <a href="c-editor.html#83913"><i class="title">3. Editor</i></a>).<div class="frame"><h4 class="EntityTitle"><a name="100052"><font face="Helvetica, sans-serif" size="-1" class="sans">Figure 4-9: New File Dialog Box</font></a></h4><dl class="margin"><div class="CellBody"><a name="100057"> </a><img class="figure" border="0" src="images/c-builder41.gif"></div></dl></div> </p><dd><p class="Body"><a name="85838"> </a>Add existing files to a project by right-clicking in the <b class="guiLabel"><font face="Helvetica, sans-serif" size="-1" class="sans">Workspace</font></b> window, selecting <b class="guiLabel"><font face="Helvetica, sans-serif" size="-1" class="sans">Add Files</font></b> or <b class="guiLabel"><font face="Helvetica, sans-serif" size="-1" class="sans">Add Files from project </font></b>from the context menu, and then using the associated dialog box to locate and select the file(s). </p><dd><p class="Body"><a name="102859"> </a>To link object files with your project, use the <b class="guiLabel"><font face="Helvetica, sans-serif" size="-1" class="sans">Linker</font></b> page of the build specification property sheet (see <a href="c-builder5.html#101163"><i class="title">Linker Options</i></a>). To link library (archive) files with your project, add the libraries to the list defined by the <b class="symbol_UC">LIBS</b> macro in the <b class="guiLabel"><font face="Helvetica, sans-serif" size="-1" class="sans">Macros</font></b> page of the build specification property sheet (see <a href="c-builder5.html#93401"><i class="title">Makefile Macros</i></a>).</p><dd><p class="Body"><a name="97631"> </a>Remove files from the project by right-clicking on the file name and selecting <b class="guiLabel"><font face="Helvetica, sans-serif" size="-1" class="sans">Remove </font></b>from the context menu, or by selecting the file name and pressing <kbd>DELETE</kbd>.</p></dl></dl><dl class="margin"><dd><p class="table" callout><table border="0" cellpadding="0" cellspacing="0"><tr valign="top"><td valign="top" width="40"><br><img border="0" alt="*" src="icons/caution.gif"></td><td><hr><div class="CalloutCell"><a name="102153"><b class="symbol_UC"><font face="Helvetica, sans-serif" size="-1" class="sans">CAUTION: </font></b></a>Adding a file to a project or removing a file from a project does not affect its existence in the file system. The project facility does not copy, move, or delete user source files; merely the project facility's references to them. Removing a file from one workspace context does not affect references to it in any others, nor its existence on disk. However, if a file is included in more than one project or workspace, an edit made in one context will be reflected in all (if this behavior is not desired, copy source files to another directory before adding them to a project). </div></td></tr><tr valign="top"><td></td><td><hr></td></tr><tr valign="middle"><td colspan="20"></td></tr></table></p callout></dl><font face="Helvetica, sans-serif" class="sans"><h4 class="H4"><i><a name="85820">Displaying and Modifying File Properties</a></i></h4></font><dl class="margin"><dl class="margin"><dd><p class="Body"><a name="85824"> </a>To display information about the properties of a file, right-click on the file name in the <b class="guiLabel"><font face="Helvetica, sans-serif" size="-1" class="sans">Workspace</font></b> window, and select <b class="guiLabel"><font face="Helvetica, sans-serif" size="-1" class="sans">Properties</font></b> from the context menu. The extent of information displayed depends on the type of file and whether or not <b class="command">make</b> dependencies have been generated. In the case of source code, a <b class="guiLabel"><font face="Helvetica, sans-serif" size="-1" class="sans">Properties</font></b> sheet for the file appears, displaying information about <b class="command">make</b> dependencies; general file attributes such as modification date; and the associated make target, custom dependencies, and commands used for the build process (<a href="c-builder2.html#86226">Figure 4-10</a>). <div class="frame"><h4 class="EntityTitle"><a name="86226"><font face="Helvetica, sans-serif" size="-1" class="sans">Figure 4-10: Source File Property Sheet</font></a></h4><dl class="margin"><div class="CellBody"><a name="86230"> </a><img class="figure" border="0" src="images/c-builder16.gif"></div></dl></div> </p><dd><p class="Body"><a name="101282"> </a>See <a href="c-builder2.html#96547"><i class="title">Calculating Makefile Dependencies</i></a>, for information about how and when to calculate makefile dependencies. See <a href="c-builder5.html#93389"><i class="title">Compiler Options</i></a> for information about overriding default compiler options for individual files.</p></dl></dl><font face="Helvetica, sans-serif" class="sans"><h4 class="H4"><i><a name="85827">Opening, Saving, and Closing Files</a></i></h4></font><dl class="margin"><dl class="margin"><dd><p class="Body"><a name="85828"> </a>The <b class="guiLabel"><font face="Helvetica, sans-serif" size="-1" class="sans">File</font></b> menu and context menu provides options for opening, saving, and closing files. You can also use standard Windows key and mouse shortcuts (such as double clicking on a file name to open the file in the editor, using <kbd>CTRL+S</kbd> to save a file, and so on).</p><dd><p class="Body"><a name="105397"> </a>See <a href="c-customize.html#83918"><i class="title">9. Customization</i></a> for information about customizing the editor, including how it handles DOS and UNIX end-of-line markers.</p></dl></dl><font face="Helvetica, sans-serif" class="sans"><h4 class="H3"><i><a name="88884">4.2.4 Building a Downloadable Application</a></i></h4></font><dl class="margin"><dl class="margin"><dd><p class="Body"><a name="105463"> </a>The project facility uses the GNU <b class="command">make</b> utility to automate compiling and linking an application.<sup><a href="#foot"><b class="FootnoteMarker">3</b></a></sup> It creates a makefile automatically prior to building the project. But before it can create a makefile, the makefile dependencies must be calculated. The calculation process, which is based on the project files' preprocessor <b class="symbol_lc">#include </b>statements, is also an automated feature of the project facility. </p><dd><p class="Body"><a name="105468"> </a>Binaries produced by a given build are created in a project subdirectory with the same name as the name of the build specification (<i class="textVariable">projectName</i><b class="file">\</b><i class="textVariable">buildName</i>).</p></dl></dl><dl class="margin"><dd><p class="table" callout><table border="0" cellpadding="0" cellspacing="0"><tr valign="top"><td valign="top" width="40"><br><img border="0" alt="*" src="icons/note.gif"></td><td><hr><div class="CalloutCell"><a name="105478"><b class="symbol_UC"><font face="Helvetica, sans-serif" size="-1" class="sans">NOTE: </font></b></a>All source files in a project are built using a single build specification (which includes a specific set of makefile, compiler, and linker options) at a time. If some of your source requires a different build specification from the rest, you can create a project for it in the same workspace, and customize the build specification for those files. One project's build specification can then be modified to link in the output from the other project. See <a href="c-builder5.html#101163"><i class="title">Linker Options</i></a>. </div></td></tr><tr valign="top"><td></td><td><hr></td></tr><tr valign="middle"><td colspan="20"></td></tr></table></p callout><dd><p class="table" callout><table border="0" cellpadding="0" cellspacing="0"><tr valign="top"><td valign="top" width="40"><br><img border="0" alt="*" src="icons/note.gif"></td><td><hr><div class="CalloutCell"><a name="102171"><b class="symbol_UC"><font face="Helvetica, sans-serif" size="-1" class="sans">NOTE: </font></b></a>The project facility allows you to create specifications for different types of builds, to modify the options for any one build, and to easily select the build specification you want to use at any given time. See <a href="c-builder5.html#98349"><i class="title">4.5 Working With Build Specifications</i></a>.</div></td></tr><tr valign="top"><td></td><td><hr></td></tr><tr valign="middle"><td colspan="20"></td></tr></table></p callout></dl><font face="Helvetica, sans-serif" class="sans"><h4 class="H4"><i><a name="96547">Calculating Makefile Dependencies</a></i></h4></font><dl class="margin"><dl class="margin"><dd><p class="Body"><a name="92717"> </a>To calculate makefile dependencies select <b class="guiLabel"><font face="Helvetica, sans-serif" size="-1" class="sans">Dependencies</font></b> from the workspace context menu. The <b class="guiLabel"><font face="Helvetica, sans-serif" size="-1" class="sans">Dependencies</font></b> dialog box appears (<a href="c-buildera7.html#103278">Figure 4-11</a>). Click <b class="guiLabel"><font face="Helvetica, sans-serif" size="-1" class="sans">OK</font></b>. <div class="frame"><h4 class="EntityTitle"><a name="92725"><font face="Helvetica, sans-serif" size="-1" class="sans">Figure 4-11: Dependencies Dialog Box</font></a></h4><dl class="margin"><div class="CellBody"><a name="92730"> </a><img class="figure" border="0" src="images/c-builder28.gif"></div></dl></div></p><dd><p class="Body"><a name="96607"> </a>After dependencies have been calculated, the files are listed in the <b class="guiLabel"><font face="Helvetica, sans-serif" size="-1" class="sans">External Dependencies</font></b> folder (<a href="c-builder2.html#100092">Figure 4-12</a>). <div class="frame"><h4 class="EntityTitle"><a name="100092"><font face="Helvetica, sans-serif" size="-1" class="sans">Figure 4-12: External Dependencies</font></a></h4>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -