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

2019-02-20 22:42

For now, we'll focus on writing programs in CodeWarrior using the C or C++ programming languages. This course assumes that you're pretty comfortable using at least one of these languages. CodeWarrior also supports Java development, but that will be covered in a separate class. This course concerns itself with Windows platform development. Once you get really good at programming with CodeWarrior, you can explore the other platforms for which tools have been designed. Much of what will be discussed here can also be applied to developing Mac applications.

CodeWarrior automatically checks your code for obvious errors, helps you scan it for less obvious ones (via an integrated debugger and editor), and then compiles and links the code so that your computer can understand and execute your program. Every application that you have used has been through the coding, compiling, editing, linking, and debugging process, using tools like CodeWarrior. Now you can do it too! But we still have to teach you how.

Using CodeWarrior, you can write just about any type of program you can imagine. If you are a beginner, you may choose to write an application (also known as an executable) as your first program. You might choose to create something as basic as WordPad, Microsoft's text editor, for example.

Applications are probably the simplest type of program to write, though large commercial ones like Adobe Photoshop, Microsoft Word and even CodeWarrior itself are quite complex. Other program types include control panels, dynamic linked libraries (DLLs), and plug-ins. Let's talk about these types for a minute. Under Windows, control panels are those (usually small) programs that are stored in your Control Panels directory and visible in the Control Panel section on the Start menu. The control panel itself is simply an interface to a system-wide feature, like setting the sound volume or the mouse's motion speed, for example. DLLs supply useful functions that are shared by the operating system and applications. They typically don't have a user interface

Plug-ins are similar to DLLs in that they provide small pieces of code that are used by other software. However, a single program typically uses this code. For example, Photoshop plug-ins allow programmers to easily extend the capabilities of the Photoshop application without having access to its source code. Likewise, many Web browsers use plug-ins that add extra features to the application or allow you to manipulate new content types on the Web. Many programs, including CodeWarrior, make use of this plug-in architecture.

There are plenty of other types of programs you can write once you master CodeWarrior and the programming interfaces for your operating system. In fact, once you complete this course, you can take other courses in which you will learn more in-depth methods of programming your computer. You've chosen an excellent place to begin your journey, however. So sit back, relax, and absorb the lessons in this course, and you'll be well on your way to becoming a CodeWarrior!

An Introduction to the CodeWarrior Application

CodeWarrior is a complex application. If you really want to benefit from all of its features, you should take this

time to get to know its various components and the capabilities that will be available to you. This first lesson will give you a basic overview of how the CodeWarrior IDE is set up. (That acronym gets thrown around a lot, and it's short for Integrated Development Environment. ) We'll take a look at menus, windows, and other aspects of the program. Follow along with the CodeWarrior IDE while you read through these lessons. Start by launching the IDE application. If you followed the defaults for the CodeWarrior software installation, there will be an icon that represents a shortcut to the program. Double-click on it to start the IDE. If the shortcut icon is absent (these things happen), you can typically find the program at C:\\Program Files\\Metrowerks\\CodeWarrior\\Bin\\IDE.exe. Toolbar

When you launch the CodeWarrior IDE, you'll notice a toolbar attached to the menu at the top of your screen. This toolbar (Figure 1-1) contains buttons that are shortcuts to frequently used menu items. You'll learn how to customize this toolbar -- and even the entire IDE -- in a later lesson. For now, notice that this toolbar can be used to quickly access features within the IDE.

Figure 1-1: The CodeWarrior IDE toolbar.

File Menu

The menus in the CodeWarrior IDE are set up in a relatively standard manner. The File menu contains choices that manage the care and feeding of files. It has standard items that let you create, open, save, and print files.

Edit Menu

The Edit menu will also seem familiar if you use other Windows applications. You'll find commands that cut, copy, and paste text, as well as a few other options to help programmers more easily manage source code layout. There is also a Preferences item in the Edit menu that we'll discuss later in this lesson.

View Menu

The View menu (Figure 1-2) gives you options to manage which toolbars and other windows are displayed in the CodeWarrior environment. Some of these windows include various specialty windows, such as the Watchpoints window, Expressions window, Processes window, and Global Variables window.

Figure 1-2: The Toolbar submenu of the View Menu.

Search Menu

The Search menu's commands allow you to locate source code within a single file, or within the directories of your hard disk. You can also easily replace large blocks of text or search your source code for references to other source code. These tools can be very handy, even for small projects.

Project Menu

Tools in the Project menu allow you to manage CodeWarrior projects. A project includes all of the files that make up a program you are writing, including its headers, source code, and libraries. The Project window serves as a container for these files. We'll discuss this in more depth in Lesson 2.

Debug Menu

When your source code doesn't do exactly what you want it to (or your computer crashes when you run your program), you'll develop a close relationship with the items on the Debug menu. We'll discuss debugging in Lesson 5.

Window Menu

The Window menu gives you the basic options to manage cascading and tiling windows in the CodeWarrior environment.

Help Menu

Lastly, use the Help menu to get online help with just about any item in CodeWarrior. Pretty cool setup, huh?

Getting to Know IDE Preferences

The CodeWarrior IDE has numerous preferences that you can use to customize your work environment. You may only want to change the text color, or you might want to get more personal, changing lots of settings. When you select Preferences from the Edit menu, you are presented with the IDE Preferences dialog box (Figure 1-3). There, you'll find options that control the appearance and behavior of the CodeWarrior editor, debugger, and lots more. In this section, we'll take a look at these preferences.

Figure 1-3: The Preferences dialog box.

As each item is described below, follow along in your own copy of CodeWarrior, and check out the various options available. You can get additional help by clicking on the question mark, then the item you're interested in. You'll see a terse description of the selected item's purpose. More detailed information is also available from the Help menu.

The General Preferences

? ?

Build Settings: Choose whether to save open-source code files before performing a build and how much memory to use while building.

IDE Extras: Various settings that don't belong anywhere else. Here's where you can have

CodeWarrior interoperate with a third-party text editor. The integration of editors with the IDE is often

less than perfect, but this limitation may be offset by the ability to use an editor that you know and like. ? ?

Plug-In Settings: Used by plug-in developers to assist in the debugging of plug-ins.

Shielded Folders: Directories listed here are skipped (ignored) during project and/or find and compare operations. This can be useful if you have a large directory of \hierarchy yet you do not want those files to slow down certain operations of CodeWarrior. ?

Source Trees: This lets you specify directories other than the standard ones CodeWarrior searches when it builds a program.

Editor Preferences

? ? ?

Editor Settings: Various settings to customize the way the Editor displays and manages text and windows.

Fonts and Tabs: Text size, font, tab, and other display settings for the Editor windows.

Text Colors: Like the browser display, you choose the color in which certain language elements (such as comments) appear in the Editor window.

Debugger Preferences

? ? ? ? ?

Display Settings: Various settings to customize the display of the debugger.

Windowing: How the debugger manages its windows (e.g., hiding any open editor windows). Global Settings: Various settings that customize how the debugger works on a global level, such as whether to launch a program when you open a file that contains the program's debugging information. Remote Connections: Allows debugging over TCP/IP. You can debug software on a computer on the other side of the Earth!

Java Settings/Java Debugging: Allows you to set specific java programming language options, not covered in this course.

RAD Tools

?

Layout Editor: Various settings to customize the use of rapid application development tools within CodeWarrior.

As you can see, there are numerous settings and options that can be set. Clicking the Save button will save any changes you've made. Clicking the Close box for the Preferences window will cause CodeWarrior to ignore any changes you've made. Go ahead and play with it a little before you proceed to the next lesson. Make sure the Default Text File Format (in the Editor Settings panel) remains set for DOS.

第二课 显示和定制工程和目标文件(1)

Translated from CodeWarriorU.COM


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

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

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

马上注册会员

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