GMP内存管理功能出现Clang错误
Clang error on GMP memory management functions
我有一些使用GMP的代码,在g++下编译和运行良好。
...
// get ptrs to GMP memory management functions
void *(*alloc_func_ptr) (size_t);
void *(*free_func_ptr) (void *, size_t);
mp_get_memory_functions(&alloc_func_ptr, NULL, &free_func_ptr);
...
但是当我用最新的clang++编译它时,它抛出了这个错误
gmpxx_boost_serialization.h:127: error: no matching function for call to '__gmp_get_memory_functions'
mp_get_memory_functions(&alloc_func_ptr, NULL, &free_func_ptr);
其中mp_get_memory_functions是宏
#define mp_get_memory_functions __gmp_get_memory_functions
__GMP_DECLSPEC void mp_get_memory_functions (void *(**) (size_t),
void *(**) (void *, size_t, size_t),
void (**) (void *, size_t)) __GMP_NOTHROW;
clang为什么抱怨?
试着改变:
void *(*free_func_ptr) (void *, size_t);
:
void (*free_func_ptr) (void *, size_t);
根据声明,"mp_get_memory_functions"的第三个参数是函数指针的地址(指向返回"void"而不是"void *"的函数)
相关文章:
- 获取 clang++:错误:在编译文件系统库的代码时
- clang:错误:链接器命令失败,退出代码为 1(使用 -v 查看调用) - 体系结构的未定义符号 x86_64:
- 如何修复 clang: 错误:链接器命令失败,退出代码为 1(使用 -v 查看调用)
- "Make"失败并出现 Clang 错误 - 如何从 Clang 获得错误?
- Android NDK.Build命令失败.未定义的引用.clang++:错误:链接器命令失败,退出代码为1
- Clang 错误 – 编译器错误或缺少一些细节?
- 为什么我在以下代码中收到 clang 错误?
- clang:错误:链接器命令失败,C++代码中的退出代码为 1(使用 -v 查看调用)
- NDK Clang 错误:未定义对"localeconv"的引用
- Clang 3.8 错误:参数 '-fuse-ld=gold-2.25' 中的链接器名称无效
- 限定名称和使用声明操作的 clang 错误消息
- 编译模板时的clang错误
- ld:1 个重复符号用于架构x86_64 clang: 错误:链接器命令失败,退出代码为 1(使用 -v 查看调用)
- C /R:clang:错误:Linker命令失败,出口代码1(使用-v查看调用)
- clang错误,没有可行的转换
- gcc 未给出的 Clang 错误"attempted to construct a reference element in a tuple with an rvalue"
- Clang:错误:非静态数据成员的使用无效
- 启用 openmp 时出错 - "ld: library not found for -lgomp" 和 Clang 错误
- 为什么在使用初始化语法时不调用转换运算符,为什么 clang 错误消息看起来是错误的
- 当使用 stdlibc++ 4.7 启用 C++11 时,clang 错误,而 gcc 编译正常