Apache的apr编译问题
来源: 互联网 发布时间:2016-02-17
本文导语: 下载apr-1.2.11.tar.gz包 解压到/root/code/apr-1.2.11/ 安装 写了个简单的程序,用到apr的函数,把apr的头文件包含进去,却怎么也编译不过去,提示头文件有问题,小弟无奈,写了如下程序,什么也不做,只包含几个头文件...
下载apr-1.2.11.tar.gz包
解压到/root/code/apr-1.2.11/
安装
写了个简单的程序,用到apr的函数,把apr的头文件包含进去,却怎么也编译不过去,提示头文件有问题,小弟无奈,写了如下程序,什么也不做,只包含几个头文件,还是编译不过去,我实在是不知道怎么编译,请各位大哥帮帮忙啊
myapr.c
#include
#include
#include
#include
#include
#include
int main(void)
{
return 1;
}
编译
gcc -o test myapr.c -I/root/code/apr-1.2.11/include/
提示错误
In file included from aprmain.c:5:
/root/code/apr-1.2.11/include/apr.h:273: parse error before "apr_off_t"
/root/code/apr-1.2.11/include/apr.h:273: warning: data definition has no type or storage class
In file included from /root/code/apr-1.2.11/include/apr_file_io.h:29,
from /root/code/apr-1.2.11/include/apr_network_io.h:26,
from aprmain.c:6:
/root/code/apr-1.2.11/include/apr_file_info.h:204: parse error before "apr_off_t"
/root/code/apr-1.2.11/include/apr_file_info.h:204: warning: no semicolon at end of struct or union
/root/code/apr-1.2.11/include/apr_file_info.h:206: warning: data definition has no type or storage class/root/code/apr-1.2.11/include/apr_file_info.h:219: parse error before '}' token
In file included from /root/code/apr-1.2.11/include/apr_network_io.h:26,
from aprmain.c:6:
/root/code/apr-1.2.11/include/apr_file_io.h:551: parse error before "apr_off_t"
/root/code/apr-1.2.11/include/apr_file_io.h:747: parse error before "apr_off_t"
In file included from aprmain.c:6:
/root/code/apr-1.2.11/include/apr_network_io.h:545: parse error before "apr_off_t"
解压到/root/code/apr-1.2.11/
安装
写了个简单的程序,用到apr的函数,把apr的头文件包含进去,却怎么也编译不过去,提示头文件有问题,小弟无奈,写了如下程序,什么也不做,只包含几个头文件,还是编译不过去,我实在是不知道怎么编译,请各位大哥帮帮忙啊
myapr.c
#include
#include
#include
#include
#include
#include
int main(void)
{
return 1;
}
编译
gcc -o test myapr.c -I/root/code/apr-1.2.11/include/
提示错误
In file included from aprmain.c:5:
/root/code/apr-1.2.11/include/apr.h:273: parse error before "apr_off_t"
/root/code/apr-1.2.11/include/apr.h:273: warning: data definition has no type or storage class
In file included from /root/code/apr-1.2.11/include/apr_file_io.h:29,
from /root/code/apr-1.2.11/include/apr_network_io.h:26,
from aprmain.c:6:
/root/code/apr-1.2.11/include/apr_file_info.h:204: parse error before "apr_off_t"
/root/code/apr-1.2.11/include/apr_file_info.h:204: warning: no semicolon at end of struct or union
/root/code/apr-1.2.11/include/apr_file_info.h:206: warning: data definition has no type or storage class/root/code/apr-1.2.11/include/apr_file_info.h:219: parse error before '}' token
In file included from /root/code/apr-1.2.11/include/apr_network_io.h:26,
from aprmain.c:6:
/root/code/apr-1.2.11/include/apr_file_io.h:551: parse error before "apr_off_t"
/root/code/apr-1.2.11/include/apr_file_io.h:747: parse error before "apr_off_t"
In file included from aprmain.c:6:
/root/code/apr-1.2.11/include/apr_network_io.h:545: parse error before "apr_off_t"
|
gcc -o test myapr.c -I/root/code/apr-1.2.11/include/
你编译你的程序还是用了 -I/root/code/apr-1.2.11/include/
其实你如果make install了的话, 没有必要用-I/root/code/apr-1.2.11/include/ 了,
因为apr的头文件会默认装到你的/usr/local/include/里的,
编译时把-I/root/code/apr-1.2.11/include/ 去了试一试。
你编译你的程序还是用了 -I/root/code/apr-1.2.11/include/
其实你如果make install了的话, 没有必要用-I/root/code/apr-1.2.11/include/ 了,
因为apr的头文件会默认装到你的/usr/local/include/里的,
编译时把-I/root/code/apr-1.2.11/include/ 去了试一试。