I wrote a small Hello World app.
#include <stdio.h>
int main(int argc, const char * argv[])
{
print开发者_高级运维f("Hello World\n");
}
When I run
gcc fileName.c
nothing is returned to the terminal. Can someone tell me what I'm doing wrong?
gcc is the compiler. it outputs a file called a.out
unless specified otherwise using the -o
flag, for example gcc -o myprogram fileName.c
which will create an executable called myprogram from the source myFile.c.
To run your program write: ./a.out
in the terminal
To compile an executable, you need to run:
gcc fileName.c -o app
That will create an executable file named app
in the current directory. You then run that executable with:
./app
精彩评论