亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定

多文件編譯報錯。

http://img1.sycdn.imooc.com//55791b6b000143f009310431.jpg

報錯:warning: implicit declaration of function 'maxNum' is invalid in C99 [-Wimplicit-function-declaration]

代碼如下:

是gcc版本問題么?是不是hello.c中要引入max.o?怎么引入?

wubiao@xMac0?cStudy$cat?hello.c?
#include?<stdio.h>
int?main()
{
	int?a?=?33;
	int?b?=?20;
	int?m;
	m?=?maxNum(a,b);
	printf("the?max?value?is?%d\n",m);
	return?0;
}
wubiao@xMac0?cStudy$cat?max.c?
int?maxNum(int?a,int?b)
{
	return?a>b?a:b;
}
wubiao@xMac0?cStudy$gcc?-c?max.c?-o?max.o
wubiao@xMac0?cStudy$ls
hello.c????max.c??????max.o??????test.c?????whichDay.c
wubiao@xMac0?cStudy$gcc?max.o?hello.c?
hello.c:7:6:?warning:?implicit?declaration?of?function?'maxNum'?is?invalid?in?C99?[-Wimplicit-function-declaration]
????????m?=?maxNum(a,b);
????????????^
1?warning?generated.


正在回答

3 回答

按照老師后面的步驟,先定義一個max.h頭文件,然后在hello.c中寫入該頭文件就好了

1 回復 有任何疑惑可以回復我~
#1

supercoko

按老師講的話,在講解“.h”頭文件之前老師就是這樣做的,但并沒有錯?。?/div>
2016-03-18 回復 有任何疑惑可以回復我~
#2

supercoko

并不用 寫入max.h
2016-03-18 回復 有任何疑惑可以回復我~

這個需要請教高手~

0 回復 有任何疑惑可以回復我~

貌似高端。

0 回復 有任何疑惑可以回復我~

舉報

0/150
提交
取消

多文件編譯報錯。

我要回答 關注問題
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號