免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 2662 | 回复: 6
打印 上一主题 下一主题

[C++] 包含进boost的shared_ptr后... [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2013-05-14 16:08 |只看该作者 |倒序浏览
[root@bogon loginserver]# make linux
g++ -g -c cLoginServer.cpp -o ./obj/debug/cLoginServer.o  -I../boost/ -lpthread -lrt
g++ -g -c main.cpp -o ./obj/debug/main.o  -I../boost/ -lpthread -lrt
In file included from /usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/bits/stl_algo.h:61,
                 from /usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/algorithm:62,
                 from ../boost/boost/smart_ptr/shared_ptr.hpp:42,
                 from ../public/TimerQueue.h:13,
                 from main.cpp:16:
/usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/bits/algorithmfwd.h:364:41: error: macro "min" passed 3 arguments, but takes just 2
In file included from /usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/bits/stl_algo.h:61,
                 from /usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/algorithm:62,
                 from ../boost/boost/smart_ptr/shared_ptr.hpp:42,
                 from ../public/TimerQueue.h:13,
                 from main.cpp:16:
/usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/bits/algorithmfwd.h:360: error: expected unqualified-id before ‘const’
/usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/bits/algorithmfwd.h:360: error: expected ‘)’ before ‘const’
/usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/bits/algorithmfwd.h:360: error: expected ‘)’ before ‘const’
/usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/bits/algorithmfwd.h:360: error: expected ‘)’ before ‘const’
/usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/bits/algorithmfwd.h:360: error: expected initializer before ‘const’
/usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/bits/algorithmfwd.h:364: error: template declaration of ‘const _Tp& std::min’
In file included from /usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/algorithm:62,
                 from ../boost/boost/smart_ptr/shared_ptr.hpp:42,
                 from ../public/TimerQueue.h:13,
                 from main.cpp:16:
/usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/bits/stl_algo.h: In function ‘void std::__merge_sort_loop(_RandomAccessIterator1, _RandomAccessIterator1, _RandomAccessIterator2, _Distance)’:
/usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/bits/stl_algo.h:3239: error: expected unqualified-id before ‘(’ token
/usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/bits/stl_algo.h: In function ‘void std::__merge_sort_loop(_RandomAccessIterator1, _RandomAccessIterator1, _RandomAccessIterator2, _Distance, _Compare)’:
/usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/bits/stl_algo.h:3263: error: expected unqualified-id before ‘(’ token
make: *** [main.o] Error 1



这个是什么错~?
boost里  smart_ptr/shared_ptr.hpp  第42行: #include <algorithm>
把他注释掉就好了
是和系统冲突?

论坛徽章:
0
2 [报告]
发表于 2013-05-14 16:13 |只看该作者
本帖最后由 Frahm 于 2013-05-14 16:13 编辑

应该是被宏定义污染了

论坛徽章:
4
水瓶座
日期:2013-09-06 12:27:30摩羯座
日期:2013-09-28 14:07:46处女座
日期:2013-10-24 14:25:01酉鸡
日期:2014-04-07 11:54:15
3 [报告]
发表于 2013-05-14 16:13 |只看该作者
不要都using进来.

论坛徽章:
0
4 [报告]
发表于 2013-05-14 16:21 |只看该作者
回复 3# linux_c_py_php


    我只拷贝了boost里shared_ptr需要的目录和文件

论坛徽章:
4
水瓶座
日期:2013-09-06 12:27:30摩羯座
日期:2013-09-28 14:07:46处女座
日期:2013-10-24 14:25:01酉鸡
日期:2014-04-07 11:54:15
5 [报告]
发表于 2013-05-14 16:30 |只看该作者
不要都using进来的意思就是带着名字空间去访问.

因为algorithm里极有可能已经using了tr1::shared_ptr了。

论坛徽章:
0
6 [报告]
发表于 2013-05-14 16:33 |只看该作者
回复 5# linux_c_py_php


    你意思是  boost::shared_ptr    去访问?  已经是这样的~

论坛徽章:
9
CU大牛徽章
日期:2013-04-17 11:06:23CU大牛徽章
日期:2013-04-17 11:08:52CU大牛徽章
日期:2013-04-17 11:09:10CU大牛徽章
日期:2013-04-17 11:09:40CU大牛徽章
日期:2013-04-17 11:09:57CU大牛徽章
日期:2013-04-17 11:10:17CU大牛徽章
日期:2013-05-20 10:43:41CU大牛徽章
日期:2013-05-20 10:44:06CU大牛徽章
日期:2013-05-20 10:44:16
7 [报告]
发表于 2013-05-15 10:07 |只看该作者
:wink:
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP