Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Using <code>cd Desktop</code> and <code>gcc /Users/reneelion/Desktop/[filename]</code> is redundant.</p> <p>Once you have changed your directory to the desktop, you no longer need to write the full filepath. You can write the path to your file as the relation between your current directory and the file. In your case:</p> <pre><code>/Users/reneelion&gt; //you begin (most likely) in your user directory /Users/reneelion&gt; cd Desktop //change directory to desktop /Users/reneelion/Desktop&gt; gcc average.c //now you are in the desktop folder, //no need to rewrite the full path //to your file </code></pre> <hr> <p>The syntax for using the <a href="http://www.rapidtables.com/code/linux/gcc.htm" rel="nofollow noreferrer">GCC (GNU Compiler Collection)</a> is as follows:</p> <pre><code>gcc [options] [source files] [object files] [-o output file] </code></pre> <p><code>[Options]</code><br> You can use different options to do things such as hiding error messages and getting debug information.</p> <p><code>[source files]</code><br> Are the files (or file) you want to compile. In your case <code>average.c</code>.</p> <p><code>[object files]</code><br> Object files contain low level instructions and are created when you compile your code. Executables are created by linking these object files together. You may recognize the <code>.o</code> extension.<br> See: <a href="https://stackoverflow.com/questions/7718299/whats-an-object-file-in-c">What&#39;s an object file in C?</a></p> <p><code>[-o output file]</code><br> -o is a special option in GCC that names the output of a compiled file. In your case it appears you are trying to name your output <code>average</code>. If you don't use this option, your program will still compile and can be run by using the default <code>a.out</code> executable.</p> <p>What you typed would most likely be interpreted as an attempt to combine a source file "<code>average.c</code>" with an object file called "<code>average</code>". Since there is as of yet no file object or otherwise called "<code>average</code>" your call is not working.</p> <p>Putting it all together:</p> <pre><code>cd Desktop //change directory to desktop gcc average.c -o average //compile average.c into an executable called average. ./average //run the executable </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload