Firstly using the gcc switch -c you are telling the compiler to only compile and not link which doesn't produce an executable binary to get an executable binary you need to not use this switch. The correct command would be:
gcc cents.c
However since this command does not specify the output file name the default name a.out will be used for the binary so you probably want to use this command:
gcc cents.c -o cents
Which will produce an executable binary called cents which can then be executed with
./cents
As for your other question you don't run header files that is not their purpose, header files are source code files the same as .c except their job is to be processed by the c preprocessor. Generally they are used to contain function prototypes for libraries to ensure that the same definitions are used throughout the project even if later the function requires a change to the prototype this helps to minimise errors and resulting bugs when changes are made in the program since the risk of someone missing a source file when changing the definition is otherwise high in large projects.
gcc cents.o -o cents -lm
(-lm brings in the libm.so library.) – user3629249 May 24 '16 at 20:50-ld
parameter to the link statement? – user3629249 May 24 '16 at 20:51cd /home/sam/sam.c
thengcc -Wall -Wextra -pedantic -c cents.c -o cents.o -I.
thengcc cents.o -o cents -lm
and finally./cents
– user3629249 May 24 '16 at 20:55gcc
compiler. Pay special attention to the options/parameters that are available (most of them you will never use.) – user3629249 May 24 '16 at 20:56round()
, read/understand the man page for that function. – user3629249 May 24 '16 at 20:58