【发布时间】:2018-04-15 17:03:56
【问题描述】:
我用 C 编写了一个 ftp 客户端(使用 GNU make),现在想使用 Qt 为其编写一个 GUI。
构建时发生错误:
error: symbol(s) not found for architecture x86_64
linker command failed with exit code 1 (use -v to see invocation)
Undefined symbols for architecture x86_64:
"showHelpMsg()", referenced from:
_main in main.o
我的main.cpp 看起来像这样:
include "client.h"
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
ftpClient w;
w.show();
showHelpMsg();
return a.exec();
}
client.h:
#include"common.h"
#include"handler.h"
#include"util.h" //These headers works fine while using gnu make
void showHelpMsg();
client.c:
include "client.h"
void showHelpMsg()
{
//....
}
还有我的project.pro:(Qt自动生成)
SOURCES += main.cpp\
ftpclient.cpp \
client.c \
common.c \
handler.c \
util.c
HEADERS += ftpclient.h \
client.h \
common.h \
handler.h \
util.h
作为参考,这是我以前的makefile:
objects = client.o handler.o util.o common.o
server : $(objects)
cc -Wall -o client $(objects)
.PHONY : clean
clean :
rm client $(objects)
【问题讨论】: