CrossPlatform/C++/boost example/HPP head file (No lib link)

99 篇文章 0 订阅
24 篇文章 0 订阅

 

$ g++ -I ./boost_1_51_0   my-boost-hpp-example.cpp
$ ls
a.out  boost_1_51_0   my-boost-example.cpp
$ ldd a.out
        linux-vdso.so.1 =>  (0x00007fff3a1de000)
        libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f9bc18e1000)
        libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f9bc16cb000)
        libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f9bc1301000)
        libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f9bc0ff8000)
        /lib64/ld-linux-x86-64.so.2 (0x00007f9bc1c63000)

### This demo is hpp included, no lib link needed
$ file a.out
a.out: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/l, for GNU/Linux 2.6.32, BuildID[sha1]=8ca61657a3fa8fc58409761b1be18eec1a0e04f8, not stripped

## Try to build 32 bit
$ g++ -I ./boost_1_51_0     -m32  my-boost-example.cpp
$ ./a.out
1
3 2
6 2
6
$ echo 1 2 3 |./a.out
3 6 9

$ file a.out
a.out: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked, interpreter /lib/ld-, for GNU/Linux 2.6.32, BuildID[sha1]=61b3959a3816dff4ae3cd3ae9b4fdfe855478bb7, not stripped
jhula@ShSwDev2:~/local/JCI-Native-Components/third-party$ ./a.out
122
366 3
9
$ ldd  ./a.out
        linux-gate.so.1 =>  (0xf77c4000)
        libstdc++.so.6 => /usr/lib32/libstdc++.so.6 (0xf7625000)
        libgcc_s.so.1 => /lib/i386-linux-gnu/libgcc_s.so.1 (0xf7608000)
        libc.so.6 => /lib/i386-linux-gnu/libc.so.6 (0xf7452000)
        libm.so.6 => /lib/i386-linux-gnu/libm.so.6 (0xf73fd000)
        /lib/ld-linux.so.2 (0xf77c5000)
$


 

/*
 *
 * g++ -I ./boost_1_51_0   my-boost-hpp-example.cpp
 *
 * */
#include <boost/lambda/lambda.hpp>
#include <iostream>
#include <iterator>
#include <algorithm>

int main()
{
        using namespace boost::lambda;
        typedef std::istream_iterator<int> in;
        std::for_each(
                in(std::cin), in(), std::cout << (_1 * 3) << " " );
}

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值