CodeWarrior软件与编程的讲解(完整版)(5)

2019-02-20 22:42

Figure 2-6: Back in the Project window, clicking the Link Order tab displays a list of component files included in the current project.

Targets

Figure 2-7: The Hello World project's Target tab.

After you've chosen the files and defined their link order, you must configure the target. The target is essentially the output file -- in our case, the Hello World application. There are also a lot of settings that must be set behind the scenes to make it possible for you to hit the target. If you double-click the Hello World target in the Targets Tab (Figure 2-7), you should see the dialog box shown in Figure 2-8.

Figure 2-8: Set targeting preferences in the Settings window.

Configuring Target Settings

The preferences you learned about in Lesson 1 are global settings used throughout the CodeWarrior IDE. Now, let's take a look at options for configuring target options. I will briefly examine the most important of these options. Follow along in your copy of CodeWarrior by double-clicking an item under the Target tab to bring up the Settings panel.

If you want a little extra guidance, move your cursor over an item in the panel, right-click it, and read the pop-up help text that appears.

Note: Some of the items listed below are specific to the target we are currently viewing, in this case the Hello World target. If you're using AMD's K6 or Athlon processors, some of these panels may contain items that use features specific to that chip. Consult the documentation for the compiler/linker that you are using to ensure that you are making the best use of your development environment.

Target Preferences

Target preferences include the following items, each with its own panel:

? ?

Target Settings: Choose the target's name (the name that appears in the target pop-up menu), which linker(s) to use, and the output directory here.

Access Paths: Access paths tell CodeWarrior where to search for required files that are a part of the project but not necessarily project-specific (such as header files). CodeWarrior will not, by

default, search your entire hard disk for files. It will only look where you explicitly tell it to look with access paths. ? ?

Build Extras: A few miscellaneous settings to improve the build speed.

Runtime Settings: In order to debug non-application code, such as a plug-in, you must have an application assist you. The application does this by calling the suspect plug-in code. This panel lets you specify the host application to use in this situation. This topic will be mentioned in Lesson 8. ?

File Mappings: Every file must be mapped so as to identify it to the compiler. That is, this panel tells CodeWarrior that files ending in .cpp are C++ source files and should therefore be compiled using the C++ compiler. See Figure 2-9 for more examples.

Figure 2-9: The File Mappings options allow you to specify the treatment of files, based on their extension.

? ?

Source Trees: Source trees are similar to access paths. Here you can enter file locations, such as file servers, that are specific to your project.

x86 Target: This panel allows you to set the type of project (application, library, or DLL), and various aspects of the project -- including how much memory the resulting program requires. It is also where you specify the name of the file output by the IDE. This name can -- and usually will -- be different from the target's name (the one entered into the Target Settings panel).

Setting Other Preferences

CodeWarrior includes a variety of additional preferences that can help you customize your environment

before beginning to work on your own programs.

Language Settings

Language Settings include the following items: (discussed further in Lesson 3)

?

C/C++ Language: There are an extremely large number of settings for the C/C++ compiler. Suffice it to say that you can alter them here. See Figure 2-11.

Figure 2-10: C++ Language settings.

? C/C+ Warnings: These settings (Figure 2-10) tell the C/C++ compiler whether to provide warnings as your code is being compiled. Sometimes source code can contain elements that aren't quite correct but are not necessarily errors. These are called warnings. You can instruct the compiler to treat all warnings as errors so that you can quickly examine the questionable code in the editor.

? Windows RC: A Windows-specific resource compiler. Resources are graphic elements (such as windows, buttons, and menu items) that can be built independent of your program code. This panel lets you specify a header file that the resource compiler uses when generating these interface elements.

Code Generation

Code Generation preferences include the following items:

?

x86 Processor: There are a number of decisions your compiler must make as it generates the

machine code from your C or C++ source code. The settings in this panel help the compiler to optimize your code. This item will be labeled differently on each CodeWarrior platform. Figure 2-11 shows the x86 version. This is discussed more in Lesson 3.

Figure 2-11: x86 Processor settings are specific to projects intended for a x86-based computer. CodeWarrior includes settings for each operating system it supports (directly, or through plug-ins).

? Global Optimizations: This has got to be one of the most exciting and useful panels in all of CodeWarrior (see Figure 2-12). This panel allows you to set the global optimization level of the compiler. This means that you can control how efficient and fast the compiler tries to make your source code. However, speed comes at a price. The smaller and faster the source code, the more difficult it is to debug, and the longer it takes to compile. Fortunately, the panel spells it all out for you so you can make that decision every time you optimize!If you want to, I mean. You will have a great deal of fun with this panel as you adjust the settings to suit your needs and your projects.


CodeWarrior软件与编程的讲解(完整版)(5).doc 将本文的Word文档下载到电脑 下载失败或者文档不完整,请联系客服人员解决!

下一篇:2017高考全国卷1数学试题及答案解析理科

相关阅读
本类排行
× 注册会员免费下载(下载后可以自由复制和排版)

马上注册会员

注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信: QQ: