我的gcc编译单个文件的时候没问题 但就是找不到自定义头文件里函数 几个文件是这样子的
test.c:
#include "print.h"
int main()
{
print("hello world\n!");
return 0;
}
print.h:
#ifndef _PRINT_H
#define _PRINT_H
void print(char *str1);
#endif
print.c:
#include "print.h"
#include <stdio.h>
void print(char *str1)
{
printf("%s",str1);
}
然后 gcc -o test test.c
提示是:
/tmp/cckKFlSB.o: In function `main':
test.c:(.text+0x19): undefined reference to `print'
collect2: ld 返回 1
不知道是不是gcc没配置好的缘故 请高位高手帮忙 谢了先
gcc求助
- bones7456
- 帖子: 8495
- 注册时间: 2006-04-12 20:05
- 来自: 杭州
- 联系:
-
- 帖子: 7
- 注册时间: 2008-01-31 14:37
-
- 帖子: 7
- 注册时间: 2008-01-31 14:37