开发者

printf doesn't return anything when using the Mac Terminal Utility

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
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜