|
Compile command: /class/sce/rcpp/tools/rcpp-make appears in the mini-buffer at the bottom of the XEmacs window. Press Enter. |
This is the command that creates your executable files. When you select this, it will compile and link all of the .cpp files in your current directory which need to be recompiled. Normally, a file with a ".cpp" extension is the source code for an executable Resolve/C++ program.
Notice that a new buffer is automatically created in your XEmacs window as shown in the next figure. The buffer is titled *compilation* and is used to show the status of the compiler and linker, as well as the error messages.

Also note that when the cursor is in the *compilation* buffer
the "Resolve/C++" menu is replaced by a menu titled "Compile."
This menu contains different commands that you may use while your program
is being compiled. For example, sometimes you may want to stop the compilation
process because you see an error and want to correct it immediately. You
can use the "Kill Compilation" option within the "Compile"
menu for that purpose.
|
|
The first compilation error message appears at the top of the *compilation* buffer, while the cursor is positioned at the beginning of the line where the error was detected in the Euclid.cpp buffer.

Your first error message should be the following, or something very similar:
Euclid.cpp:96: error: `If' undeclared (first use this function)This error means that "If" is not recognized by the compiler as a word (that is to say, a symbol) that has been prevously declared. Do you know what's wrong? The "I" in the keyword if is capitalized. C++ is case-sensitive, so "If" is not the same as "if".
|
|
Your new error message (remember to use "First Error") should indicate that the compiler expected a semicolon (';')
before the } that follows the statement
small &= large.

Note that small &= large is not followed by a semicolon
(;). Every statement in C++ has to be terminated by a semicolon.
|
|
The new error message will appear at the top of the *compilation* buffer, and the cursor will be positioned at the appropriate line in the program. The error message indicates that the compiler expected a right (that is to say, closing) parenthesis before the { which follows the if. (Despite the fairly high quality of the error messages we've seen so far, sometimes the compiler cannot detect exactly what the problem is, and will just indicate the presence of an error somewhere before the point when it detected the error.)

Can you guess what the precise problem is? The number of left parentheses in
the if-condition ((small < 0) or (large <= 0) is
not the same as the number of right parentheses. Specifically, there is
a right parenthesis missing.
|
|
As it turns out, insertion of this right parenthesis has solved our
earlier problem of the statement we inserted being indented too far by
the Tab key. Now the Tab key will indent this line properly.
|
|

| Previous | Table of Contents | Continue |