小男孩‘自慰网亚洲一区二区,亚洲一级在线播放毛片,亚洲中文字幕av每天更新,黄aⅴ永久免费无码,91成人午夜在线精品,色网站免费在线观看,亚洲欧洲wwwww在线观看

分享

GCC編譯多個(gè)C文件

 Rainboy913 2013-11-28

下午做了一個(gè)小的程序,定義了三個(gè)文件:getop.h,getop.c,calcDemo.c

顯然getop.h是針對(duì)getop.c的,而在calcDemo.c中要調(diào)用到getop.c中的東西。

首先給出每個(gè)文件的結(jié)構(gòu)圖,為了更簡(jiǎn)單的說(shuō)明,函數(shù)都空實(shí)現(xiàn)。

getop.h:

#ifndef _H_GETOP
#define _H_GETOP
 int getch(void);
 void ungetch(int c);
 int getop(char s[]);
#endif

getop.c

 

#include <stdio.h>
#include <ctype.h>
#define NUMBER '0'
int getch(void);
void ungetch(int);


int getop(char s[])
{
 return 0;

}

#define BUFSIZE 100
char buf[BUFSIZE];
int bufp =0;

int getch(void)
{
  return 0;
}

void ungetch(int c)
{

}

calcDemo.c

#include <stdio.h>
#include <stdlib.h>
#include "getop.h" //只需這樣引用即可

 

最后,即是利用gcc來(lái)編譯這幾個(gè)文件:

gcc getop.c calcDemo.c -o output.out

編譯后的目標(biāo)文件即為:output.out

然后執(zhí)行:./output.out即可

 


 

 

 

    本站是提供個(gè)人知識(shí)管理的網(wǎng)絡(luò)存儲(chǔ)空間,所有內(nèi)容均由用戶發(fā)布,不代表本站觀點(diǎn)。請(qǐng)注意甄別內(nèi)容中的聯(lián)系方式、誘導(dǎo)購(gòu)買(mǎi)等信息,謹(jǐn)防詐騙。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請(qǐng)點(diǎn)擊一鍵舉報(bào)。
    轉(zhuǎn)藏 分享 獻(xiàn)花(0

    0條評(píng)論

    發(fā)表

    請(qǐng)遵守用戶 評(píng)論公約

    類(lèi)似文章 更多