0
我得到的错误:未定义的引用“的ReadLine” - ç
undefined reference to `readline'
这里是我的makefile:
all: stest stestdebug
stest: stest.o struct.o
gcc -g stest.o struct.o -lreadline -lncurses -o stest
stest.o: stest.c struct.h
gcc -g -c stest.c
stestdebug: stestdebug.o struct.o
gcc -g stestdebug.o struct.o -o stestdebug
stestdebug.o: stest.c struct.h
gcc -g -c stest.c -o stestdebug.o
struct.o: struct.c struct.h
gcc -g -c -DDEBUG struct.c
clean:
rm -f *.o stest stestdebug
docs:
doxygen
chmod a+r html/*
cp -p html/* ~/public_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:");
}
您对stest目标有-lreadline,但对stestdebug目标没有。 –
这是一个[重复](https://stackoverflow.com/questions/14773420/undefined-reference-to-readline)或一个错字;可能都是。 – 5gon12eder