I'm trying to compile a simple "Hello, World" program using gcc in C programming language. I use the following command on a source code file "test.c" (without the quotes).
I use the following command:
gcc test.c -O -Wall -Werror test
I expect this to compile my program and create and executable called test that I can run the program with from the command line. However when I compile using the above line I get the following error:
gcc: test: No such file or directory
Any reason as to why this may be?
Thanks!
gcc is treating test as an input file name. Assuming you want to use test as the output file name, you need to use the -o option.
gcc test.c -O -Wall -Werror -o test
^^
You are giving the wrong commands to gcc:
do this :
gcc -Werror -Wall -O -o test test.c
-o is for output
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With