GCC的一些簡單使用方法

2021-09-12 15:58:36 字數 967 閱讀 4037

gcc的一些簡單使用方法

gcc  -g -wall hello_world.c  -o hello_world        這個命令是一步到位,直接得到可執行檔案

gcc -e   hello_world.c  >hello_world.i           得到預編譯結果

gcc - s  hello_world.c  -o hello_world.s       得到彙編

gcc  -c(小寫)  hello_world.c    -o hello.o    生成目標檔案,得不進行鏈結

strace   hello_world          strace是linux中的命令,  這樣能跟蹤hello world的執行過程,

/usr/include  目錄下有各種標頭檔案,包含stdio.h等

#include  

#include

#include

#define loops  100000

static int counter=0;

static  void *thread(void *unused)

int i;

for(i=0;i++counter;

return null;

int main (void)

pthread t1,t2;

pthread_create(&t1,null,thread,null);

pthread_create(&t2,null,thread,null);

pthread_join(t1,null);

pthread_join(t2,null);

printf("counter is %d by threads \n", counter(;

return 0;

編譯命令如下  gcc -g -wall  thread.c    -o thred  -lpthread  

Github的一些簡單的使用方法

從初中就聽聞github的是最大的同 友 但是一直不會使用,今天不知道是那根筋打錯了,把官網的簡單的教程看了一下,掌握了一些幾基本的操作,在這記錄一下 做完發現也沒有之前的那麼神秘。github最大的用處就是協同更改 github僅僅是git的乙個例項,git就是乙個管理 的系統。github使用的...

Github的一些簡單的使用方法

從初中就聽聞github的是最大的同 友 但是一直不會使用,今天不知道是那根筋打錯了,把官網的簡單的教程看了一下,掌握了一些幾基本的操作,在這記錄一下 做完發現也沒有之前的那麼神秘。github最大的用處就是協同更改 github僅僅是git的乙個例項,git就是乙個管理 的系統。github使用的...

DateTime的一些使用方法

1 datetime 數字型 system.datetime currenttime new system.datetime 1.1 取當前年月日時分秒 currenttime system.datetime.now 1.2 取當前年 int 年 currenttime.year 1.3 取當前月 ...