首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往
您找到你想要的搜索结果了吗?
是的
没有找到

boost编译

经历了将近半年多的时间boost终于发布了1.35.0版本(前版本1.34.1发布于2007/7), 其编译方法和原来的编译方法基本上是一致的,主要改变包括1.34.0以来bjam的toolset所 提供的参数名称的改变(具体参见《boost1.34.0编译日志》)外,还包括bjam的编译默认 选项的变化,在1.35.0之前的版本默认编译时会自动编译各种版本的库,包括静态库、 动态库、debug库和release库等全部的版本,但是到了1.35.0时默认的选择仅仅编译release 版本的库,这样一来在开发的时候就不能进行必要的调试了,为了能够使其编译全部的版本 需要在bjam的命令行参数中添加一个–build-type=complete类型的参数来指明需要编译全 部的版本,所需要编译同时为了使得regex库能够通过ICU库支持Unicode,在编译上需要有 一些特殊的选择。我在Visual Studio 2005 Pro + SP1环境下编译了该库,为了避免走弯路 所以将其编译的方法进行说明,以方便大家编译。 由于boost是采用其自己的bjam工具通过命令行进行编译的,所以必须在Windows下开启console窗口,同时必须将Visual Studio中C++目录下的环境vcvarsall.bat配置脚本运行一遍,以设置好VC的编译器环境变量。 1. 编译不带ICU支持的boost库 此种情况下的boost库编译起来比较的简单,在准备好的console窗口中输入:

03

在Windows10中Visual Studio2017中使用boost1.69.0

Boost是一个功能强大、构造精巧、跨平台、开源而且完全免费的C++程序库,有着“C++ '准’标准库”的美誉。 Boost是由C++标准委员会部分成员所设立的Boost社区开发并维护,使用了许多现代C++编程技术,内容涵盖字符串处理、正则表达式、容器与数据结构、并发编程、函数式编程等。目前已经更新到了1.72.0版本,官网下载地址为:https://www.boost.org/users/history/version_1_72_0.html,由于我之前在自己Windows10系统上安装的是Boost 1.69.0,其源代码下载地址为:https://sourceforge.net/projects/boost/files/boost/1.69.0/,所以本文直接演示在VS2017下使用boost1.69.0版本,使用32位的debug模式进行测试,其他的64位和VS编译器同理。

03

Thrift编译错误('::malloc' has not been declared)

问题版本:0.9.0 make[4]: Entering directory `/tmp/X/thrift-0.9.0/lib/cpp' /bin/sh ../../libtool  --tag=CXX   --mode=compile g++ -DHAVE_CONFIG_H -I. -I../..  -I/usr/local/thirdparty/boost/include -I./src -I./src/thrift -I/usr/local/thirdparty/openssl/include -Wall -g -O2 -MT Thrift.lo -MD -MP -MF .deps/Thrift.Tpo -c -o Thrift.lo `test -f 'src/thrift/Thrift.cpp' || echo './'`src/thrift/Thrift.cpp libtool: compile:  g++ -DHAVE_CONFIG_H -I. -I../.. -I/usr/local/thirdparty/boost/include -I./src -I./src/thrift -I/usr/local/thirdparty/openssl/include -Wall -g -O2 -MT Thrift.lo -MD -MP -MF .deps/Thrift.Tpo -c src/thrift/Thrift.cpp  -fPIC -DPIC -o .libs/Thrift.o In file included from src/thrift/Thrift.cpp:22: /usr/lib/gcc/x86_64-redhat-linux/4.4.6/../../../../include/c++/4.4.6/cstdlib:119: error: '::malloc' has not been declared /usr/lib/gcc/x86_64-redhat-linux/4.4.6/../../../../include/c++/4.4.6/cstdlib:127: error: '::realloc' has not been declared src/thrift/Thrift.cpp: In member function 'void apache::thrift::TOutput::printf(const char*, ...)': src/thrift/Thrift.cpp:46: error: 'malloc' was not declared in this scope make[4]: *** [Thrift.lo] Error 1 解决方法: 在成功执行configure后(在未执行configure之前找不到下列两行),修改与configure同目录下的config.h文件,将文件中的如下两行注释掉: #define malloc rpl_malloc #define realloc rpl_realloc 附1:安装Thrift命令行: ./configure --prefix=/usr/local/thirdparty/thrift-0.9.0 --with-boost=/usr/local/thirdparty/boost --with-libevent=/usr/local/thirdparty/libevent CPPFLAGS="-I/usr/local/thirdparty/openssl/include" LDFLAGS="-ldl -L/usr/local/thirdparty/openssl/lib" --with-qt4=no --with-c_glib=no --with-csharp=no --with-erlang=no --with-perl=no --with-ruby=no --with-haskell=no --with-go=no --with-d 当OpenSSL未以默认安装目录时,请注意上面的用法。 附2:相关博文: (安装thrift时,注意openssl参数)http://blog.chinaunix.net/uid-20682147-id-3399150.html 如果在使用Thrift时,编译遇到类似“TTransport.h:107: error: 'uint32_t' does not name a type”的错误,只需要在Thrift.h文件中增加一行:#include 。 Thrift.h文件位于make install后的include目录下,如果不知道在哪,可以使用find命令查找。

03
领券