CFLAGS并分配多个参考?

时间:2014-01-06 22:15:37

标签: c++ c makefile

我不习惯使用C或C ++而且我试图让编译器在哪里找到引用丢失。

我有一个名为 configure 的配置文件,用于创建makefile。

然后创建我运行的makefile:

CFLAGS=-I/usr/include/libxml2 ./configure  --enable-murder

当我运行此行但在CFLAGS中给出了两个引用?

要明确mais,编译想要指向引用:

  • / usr / include / libxml2
  • / usr / include / libical

在CFLAGS中。

这是因为我无法编辑makefile,我想修复以下错误:

http_caldav.o: In function `is_valid_timerange':
http_caldav.c:(.text+0x3c86): undefined reference to `icaltime_is_valid_time'
http_caldav.c:(.text+0x3cd8): undefined reference to `icaltime_is_valid_time'
http_caldav.c:(.text+0x3d2a): undefined reference to `icaltime_is_date'
http_caldav.c:(.text+0x3d7c): undefined reference to `icaltime_is_date'
http_caldav.c:(.text+0x3dce): undefined reference to `icaltime_is_utc'
http_caldav.c:(.text+0x3e23): undefined reference to `icaltime_is_utc'
http_caldav.o: In function `parse_comp_filter':
http_caldav.c:(.text+0x3e7d): undefined reference to `xmlStrcmp'
http_caldav.c:(.text+0x3e98): undefined reference to `xmlGetProp'
http_caldav.c:(.text+0x3eb7): undefined reference to `xmlStrcmp'
http_caldav.c:(.text+0x3f02): undefined reference to `xmlStrcmp'
http_caldav.c:(.text+0x3f19): undefined reference to `xmlStrcmp'
http_caldav.c:(.text+0x3f46): undefined reference to `xmlStrcmp'
http_caldav.c:(.text+0x3f71): undefined reference to `xmlStrcmp'
http_caldav.o:http_caldav.c:(.text+0x3f9c): more undefined references to `xmlStrcmp' follow
http_caldav.o: In function `parse_comp_filter':
http_caldav.c:(.text+0x4077): undefined reference to `xmlFree'
http_caldav.c:(.text+0x40cc): undefined reference to `xmlStrcmp'
http_caldav.c:(.text+0x40d9): undefined reference to `icaltimezone_get_utc_timezone'
http_caldav.c:(.text+0x410f): undefined reference to `xmlGetProp'
http_caldav.c:(.text+0x412d): undefined reference to `icaltime_from_string'
http_caldav.c:(.text+0x4171): undefined reference to `xmlFree'
http_caldav.c:(.text+0x41a0): undefined reference to `icaltime_from_timet_with_zone'
http_caldav.c:(.text+0x41f2): undefined reference to `xmlGetProp'
http_caldav.c:(.text+0x4210): undefined reference to `icaltime_from_string'
http_caldav.c:(.text+0x4254): undefined reference to `xmlFree'
http_caldav.c:(.text+0x4283): undefined reference to `icaltime_from_timet_with_zone'

的config.log

gcc-4.7.real: error: unrecognized command line option '-V'
gcc-4.7.real: fatal error: no input files
compilation terminated.
configure:3214: $? = 4
configure:3203: gcc -qversion >&5
gcc-4.7.real: error: unrecognized command line option '-qversion'
gcc-4.7.real: fatal error: no input files
compilation terminated.
conftest.c:13:28: fatal error: ac_nonexistent.h: No such file or directory
conftest.c:56:26: fatal error: minix/config.h: No such file or directory
conftest.c:37:9: error: unknown type name 'not'
conftest.c:37:15: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'universal'
conftest.c:37:15: error: unknown type name 'universal'
gcc-4.7.real: error: unrecognized option '-R'

我的操作系统是Debian 7。

1 个答案:

答案 0 :(得分:4)

如果要添加两个包含路径,请将它们用引号括起来

CFLAGS="-I/usr/include/libxml2 -I/usr/include/libical" ./configure --enable-murder

要修复链接器错误,您必须使用LDLIBS添加库,例如

CFLAGS="..." LDLIBS="-lxml2 -lical" ./configure --enable-murder