主题:会C的朋友麻烦进来一下,急````
你好,我有3个文件, 1.c 1.h 2.c
1.c中我写了以下代码:
#include "1.h"
int myincrement(int i)
{
return i+1;
}
1.h中我写了以下代码
int myincrement(int);
2.c中我写了以下代码
#include "1.h"
#include <stdio.h>
int test()
{
return myincrement(5);
}
main()
{
int i=0;
i=test();
printf("%d",i);
}
我编译运行2.c为什么会报错误呢,说:undefined reference to 'fred(int)'
我用cFree编的,改用turboc2编还是同样的错误. 请问大家我要怎么改啊??? 会的帮下忙啊,急用````` 我的目的就是2.c调用1.c中的方法
1.c中我写了以下代码:
#include "1.h"
int myincrement(int i)
{
return i+1;
}
1.h中我写了以下代码
int myincrement(int);
2.c中我写了以下代码
#include "1.h"
#include <stdio.h>
int test()
{
return myincrement(5);
}
main()
{
int i=0;
i=test();
printf("%d",i);
}
我编译运行2.c为什么会报错误呢,说:undefined reference to 'fred(int)'
我用cFree编的,改用turboc2编还是同样的错误. 请问大家我要怎么改啊??? 会的帮下忙啊,急用````` 我的目的就是2.c调用1.c中的方法