compile the file hello_world with gcc
دوشنبه, ۲۴ مرداد ۱۴۰۱، ۰۷:۴۳ ب.ظ
For programs with a single source file, using gcc is simple.
/* File name is hello_world.c */
#include <stdio.h>
int main(void)
{
int i;
printf("Hello world!\n");
}
To compile the file hello_world.c from the command line:
gcc hello_world.c
gcc will then compile program and output the executable to the file a.out. If you want to name the executable, use the -o option.
gcc hello_world.c -o hello_world
The executable will then be named hello_world instead of a.out. By default, there are not that many warnings that are emitted by gcc. gcc has many warning options and it is a good idea to look through the gcc documentation to learn what is available. Using '-Wall' is a good starting point and covers many common problems.
gcc -Wall hello_world.c -o hello_world
- ۰۱/۰۵/۲۴