当我尝试编译我的程序时,出现了这个错误。
我编写了一个简单的程序,包含三个文件 hello.c、hello1.c 和 hello.h。
hello1.c:
我有一个Makefile.am。
如果我执行 ---> cc hello.c -o hello.c hello1.c 。它可以正常工作。
我需要在makefile.am文件中定义其他内容吗?
谢谢。
undefined reference to `printfHello'
我编写了一个简单的程序,包含三个文件 hello.c、hello1.c 和 hello.h。
hello1.c:
#include <stdint.h>
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
void printfHello() {
printf("Hello");
}
hello1.h
void printfHello();
hello.c
#include <stdint.h>
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include "hello1.h"
int main() {
int errn=0;
printfHello();
return errn;
}
我有一个Makefile.am。
bin_PROGRAMS = client_ev
AM_CPPFLAGS = \
-I$(top_srcdir)/include \
-I$(top_builddir)/include
# $(some_CFLAGS)
EXTRA_DIST = \
autogen.sh
MAINTAINERCLEANFILES = \
configure \
aclocal.m4 \
Makefile.in
client_ev_SOURCES = hello.c hello1.c
如果我执行 ---> cc hello.c -o hello.c hello1.c 。它可以正常工作。
我需要在makefile.am文件中定义其他内容吗?
谢谢。