作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我在 C 程序中使用 apr,我包含了 appr_error.h 头文件,但在构建过程中遇到错误:
In function ‘APR_DECLARE’: error: expected declaration specifiers before ‘apr_strerror’
这是头文件中的违规行:
/**
* Return a human readable string describing the specified error.
* @param statcode The error code the get a string for.
* @param buf A buffer to hold the error string.
* @param bufsize Size of the buffer to hold the string.
*/
APR_DECLARE(char *) apr_strerror(apr_status_t statcode, char *buf,
apr_size_t bufsize);
此头文件包含一个具有 APR_DECLARE 的 #define 的头文件,如下所示:
#if !defined(WIN32)
368 /**
369 * The public APR functions are declared with APR_DECLARE(), so they may
370 * use the most appropriate calling convention. Public APR functions with
371 * variable arguments must use APR_DECLARE_NONSTD().
372 *
373 * @deffunc APR_DECLARE(rettype) apr_func(args);
374 */
375 #define APR_DECLARE(type) type
我很困惑为什么会收到此错误消息 - 有什么想法吗?
最佳答案
您的编译器标志可能已关闭,尤其是在搜索包含文件的位置时。
apr 附带了 apr-config
工具(或者可能是 apr-1-config),您应该运行该工具并将其用于编译器和链接器标志
例如
# apr-config --cflags --includes -pthread -I/usr/include/apr-0
告诉我在编译使用 APR 的 C 代码时必须传递 -pthread -I/usr/include/apr-0
。
有关于 pkg-config here 的更多信息.
关于c - 在函数 ‘APR_DECLARE’ : error: expected declaration specifiers before ‘apr_strerror’ 中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11362226/
我在 C 程序中使用 apr,我包含了 appr_error.h 头文件,但在构建过程中遇到错误: In function ‘APR_DECLARE’: error: expected declara
我是一名优秀的程序员,十分优秀!