请问大神门dev-c++中怎么编译多个文件哦
文件1:未命名1#include <stdio.h>
int A;
void main()
{
int power(int n);
int b = 3,c,d,m;
printf("enter the number a and it's power m:\n");
c = A * b;
printf("%d * %d = %d\n",A,b,c);
d = power(m);
printf("%d ^ %d = %d\n",A,m,d);
system("pause");
}
文件2:未命名2
extern A;
int power(int n)
{
int i,y = 1;
for(i = 1;i <= n;i++)
{
y *= A;
}
return y;
}
编译时候提示:未定义的函数power
如下:
C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\ccM5EzaQ.o: In function `main':
E:/YD/Y (G)/cs/未命名1.c:17: undefined reference to `power'
collect2.exe: error: ld returned 1 exit status
编译 0.19 秒后失败 (有错误)
请大神帮帮忙,我刚学c不久,还不太懂,感激不尽。
本帖最后由 yvqiang 于 2014-8-9 09:51 编辑
http://bbs.fishc.com/data/attachment/album/201408/09/093957cxiih0ioovo4lw8l.jpghttp://bbs.fishc.com/data/attachment/album/201408/09/094430t9obyaxq2gxbwjwy.jpg
我去原来建个项目就行了,可不可以不建项目哦,还多了一堆文件http://bbs.fishc.com/data/attachment/album/201408/09/102234lll516t57zze7ebb.jpghttp://bbs.fishc.com/data/attachment/album/201408/09/102237f8g3gchc67ywwqjz.jpg
页:
[1]