未定义对'的引用;readline';-C
我得到的错误是:未定义对'的引用;readline';-C,c,makefile,readline,undefined-reference,C,Makefile,Readline,Undefined Reference,我得到的错误是: 对“readline”的未定义引用 这是我的makefile: all:stest-stestdebug stest:stest.o struct.o gcc-g stest.o结构o-lreadline-LNCURES-o stest stest.o:stest.c struct.h gcc-g-c钢结构 stestdebug:stestdebug.o struct.o gcc-g stestdebug.o struct.o-o stestdebug o:stest.c s
对“readline”的未定义引用
这是我的makefile:
all:stest-stestdebug
stest:stest.o struct.o
gcc-g stest.o结构o-lreadline-LNCURES-o stest
stest.o:stest.c struct.h
gcc-g-c钢结构
stestdebug:stestdebug.o struct.o
gcc-g stestdebug.o struct.o-o stestdebug
o:stest.c struct.h
gcc-g-cstest.c-ostestdebug.o
结构o:struct.c结构h
gcc-g-c-DDEBUG struct.c
清洁:
rm-f*.o stest STESTEDEBUG
文件:
强氧
chmoda+rhtml/*
cp-p html/*~/public\u html/cs2303assig4
我已经为readline导入了所有必要的库,但仍然会出现此错误
下面是我称之为的代码:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <readline/readline.h>
#include <readline/history.h>
#include "struct.h"
void requestInput() {
printf("Please fill out all prompts to create a new emplyoee.\n");
char *name = readline("Name:");
}
#包括
#包括
#包括
#包括
#包括
#包括“struct.h”
void requestInput(){
printf(“请填写创建新员工的所有提示。\n”);
char*name=readline(“name:”);
}
您没有在主可执行文件中链接到它们
将库放在变量中,并在测试目标和正常目标中使用它们
查看LDFLAGS。您有-lreadline用于stest目标,但没有用于stestdebug目标。这是一个或一个输入错误;可能两者都有。