User Tools

Site Tools


haas:fall2017:cprog:projects:sof0

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

haas:fall2017:cprog:projects:sof0 [2017/05/28 16:53] – external edit 127.0.0.1haas:fall2017:cprog:projects:sof0 [2017/08/20 17:10] (current) – [Submission] wedge
Line 217: Line 217:
   * How many digits is the largest square?   * How many digits is the largest square?
   * How can knowing how many digits the largest square is help you implement your solution?   * How can knowing how many digits the largest square is help you implement your solution?
 +=====Review of Compiling/Executing=====
 +Just to review the compilation/execution process for working with your source code, if we had a file, **hello.c**, that we wished to compile to a binary called **hello**, we'd first want to compile the code, as follows:
 +
 +<cli>
 +lab46:~/src/cprog/proj$ gcc -Wall --std=c99 -o hello hello.c
 +lab46:~/src/cprog/proj$ 
 +</cli>
 +
 +Assuming there are no syntax errors or warnings, and everything compiled correctly, you should just get your prompt back. In the event of problems, the compiler will be sure to tell you about them.
 +
 +Conceptually, the arrangement is as follows:
 +
 +<code>
 +gcc -Wall --std=c99 -o BINARY_FILE SOURCE_FILE
 +</code>
 +
 +The BINARY_FILE comes **immediately after** the **-o**, **NOT** the SOURCE_FILE (it must never **immediately** follow a **-o**). It can precede, and such is perfectly valid (especially if you feel that way more intuitive).
 +
 +The **-Wall** (treat all warnings as errors, increase general verbosity about warnings) and **--std=c99** (switch compiler to use the **C99** standard of the C language) are options given to the compiler.
 +
 +To execute your binary, we need to specify a path to it, so we use **./**, which basically references the current directory:
 +
 +<cli>
 +lab46:~/src/cprog/proj$ ./hello
 +Hello, World!
 +lab46:~/src/cprog/proj$ 
 +</cli>
 +
 =====Submission===== =====Submission=====
 To successfully complete this project, the following criteria must be met: To successfully complete this project, the following criteria must be met:
  
   * Code must compile cleanly (no warnings or errors)   * Code must compile cleanly (no warnings or errors)
 +    * Use the **-Wall** and **--std=c99** flags when compiling.
   * Executed program must display a total of 2 lines, one for input, one for output.   * Executed program must display a total of 2 lines, one for input, one for output.
     * The computed number must be output to STDOUT     * The computed number must be output to STDOUT
haas/fall2017/cprog/projects/sof0.1495990430.txt.gz · Last modified: 2017/05/28 16:53 by 127.0.0.1