大佬看一下我这个test1.c调用test2-4.h为什么报错?
报的这个错误
C:\Users\liyua\AppData\Local\Temp\ccEB9Qjv.o:test1.c:(.text+0xe): undefined reference to `test'
collect2.exe: error: ld returned 1 exit status
下面是代码
test1.c
#include<stdio.h>
#include "test2-4.h"
void main(){
//printf("hello world\n");
test();
}
test2-4.c
#include <stdio.h>
#include "test2-4.h"
static void test_print(){
printf("testprintf\n");
}
void test(){
test_print();
}
test2-4.h
#ifndef _TEST_H_
#define _TEST_H_
void test(void);
#endif
相似问题