به نام خداوند مهربان

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
  • حسن دلدار

نظرات  (۰)

هیچ نظری هنوز ثبت نشده است

ارسال نظر

ارسال نظر آزاد است، اما اگر قبلا در بیان ثبت نام کرده اید می توانید ابتدا وارد شوید.
شما میتوانید از این تگهای html استفاده کنید:
<b> یا <strong>، <em> یا <i>، <u>، <strike> یا <s>، <sup>، <sub>، <blockquote>، <code>، <pre>، <hr>، <br>، <p>، <a href="" title="">، <span style="">، <div align="">
تجدید کد امنیتی