Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在尝试编译 C 程序,但未声明错误“RTLD_NEXT”。我认为这应该在c程序包含的dlfcn.h中定义,但是当我查看dlfcn.h内部时没有RTLD_NEXT。
我该如何解决?
这里的问题是posix 标准RTLD_NEXT没有定义。所以除非你或.#define _GNU_SOURCE-D_GNU_SOURCE
RTLD_NEXT
#define _GNU_SOURCE
-D_GNU_SOURCE
POSIX 的其他相关部分是dlfcn.h和dlsym.h。有趣的是,后面提到RTLD_NEXT. 显然,GNU 人对于什么是扩展什么不是扩展有点困惑。
根据man dlsym它是#define _GNU_SOURCE(只有一个前导下划线)在包含之前dlfcn.h。(RHEL6.1)。
man dlsym
dlfcn.h
尝试#define __GNU_SOURCE作为来源中的第一行。
#define __GNU_SOURCE
必须有一个下划线。#define _GNU_SOURCE 此外,这必须是您的第一个预处理器指令。例如:
#define _GNU_SOURCE #include <stdio.h>