gpt4 book ai didi

c++ - CFLAGS 并分配多个引用?

转载 作者:太空宇宙 更新时间:2023-11-04 06:30:41 25 4
gpt4 key购买 nike

我不习惯使用 C 或 C++,我试图让编译器在何处查找引用丢失。

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

然后创建我运行的 makefile:

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

当我运行这一行时,在 CFLAGS 中给出了两个引用?

为了清楚起见,编译要指向引用:

  • /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'

配置文件

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。

最佳答案

如果要添加两个包含路径,请将它们括在引号中

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

要修复链接器错误,您必须添加带有 LDLIBS 的库,例如

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

关于c++ - CFLAGS 并分配多个引用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20960320/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com