Linux???????gcc????
???????????? ???????[ 2016/5/12 13:24:45 ] ?????????????? Linux
????1. ????gcc??
????gcc???????GNU Compiler Collection??????????????????????????????????gcc?????C????????????GNU C Compiler???????????c??????????C++??java??Pascal???????gcc?????????????
????2. gcc?????
????gcc????????????????????????????????????ARM??X86????
????gcc????????????????????????????????????ν??????????????????????????????????????????????С???gcc??????????????????????????????С????????????????x86??????????arm?????С?
????gcc?ж????????????????????????????
????gcc?????黯?????????????????????CPU?????????
????gcc????????????κ???????????????????????
????3. gcc???????????
????gcc??????????????????????
??????????Pre-Processing??
???????? ??Compiling??
??????? ??Assembling??
???????? ??Linking??
??????????????????????????????????????Σ?gcc???ò??????????????????c????????????ccl??gcc?????????????????????????????е??ò????????????Σ?gcc???????????л?????????????????????????????????????????????????????????????λ??????????????????????????????????????е?????0??????????????????????????????????????????????????????0?????????????д?????????????????????????????????λ?????????????????????λ??????????????????????????????????????????????????仯????????????Щ????й??
????????GCC???????????衣
????4. gcc???????
???????????gcc???????
??????????????????hello.c?????????Щgcc??????????
????gcc -E hello.c -o hello.i ??hello.c???????????????????hello.i ???
????gcc -S hello.i -o hello.s ?????????????б??????????????
????gcc -c hello.s -o hello.o ??????????б???????????????
????gcc hello.o -o hello ????????????????????????????
????gcc hello.c -o hello ?????????????????????
????gcc -c hello.c ?? gcc -c hello.c -o hello.o ????????????λ??????
???????gcc????????-Wall??????????????????????-Wall????????????????κδ?????棬????????????????????
????//bad.c
????#include<stdio.h>
????int main()
????{
????printf("the number is %f "??5); //?????????the number is 0.000000?????????
????return 0;
????}
???????-Wall???
????gcc -Wall bad.c -o bad
????gcc??????????????
????warning: format ‘%f’ expects argument of type ‘double’?? but argument 2 has type ‘int’ [-Wformat=]
????printf("the number is %f
"??5);
????5. gcc?????????
???????????????????????hello.c hello.h main.c ??????????????????£?
// hello.c
#include<stdio.h>
#include"hello.h"
void printHello()
{
printf("hello world!
");
}
//main.c
#include<stdio.h>
#include"hello.h"
int main()
{
printHello();
return 0;
}
//hello.h
//??????????????
#ifndef _HELLO_
#define _HELLO_
void printHello();
#endif
?????????????????????????α???
????gcc hello.c main.c -o main ???????????main
????????????????
????gcc -Wall -c main.c -o main.o
????gcc -Wall -c hello.c -o hello.o
????gcc -Wall main.o hello.o -o main
?????????????????????????????鷢????????????????????У????????±?????????????????????????????
??????

???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11