错误在标准库?? /usr/include/g++-3/stl_algobase.h

benjiam 2005-11-29 04:19:50
c++ -DHAVE_CONFIG_H -I. -I. -I.. -O2 -O0 -g3 -Wall -fno-exceptions -fno-check-new -c msnuser2.cpp
In file included from msnuser.h:11,
from msnuser2.cpp:1:
chat.h:93:6: warning: no newline at end of file
chat.h:93:6: warning: no newline at end of file
/usr/include/g++-3/stl_algobase.h: In function `_OutputIter copy
(_InputIter, _InputIter, _OutputIter) [with _InputIter = CanShu **,
_OutputIter = CanShu **]':
/usr/include/g++-3/stl_algobase.h:184: template instantiation depth
exceeds maximum of 17 (use -ftemplate-depth-NN to increase the maximum)
instantiating `struct iterator_traits'
/usr/include/g++-3/stl_algobase.h:184: instantiated from `copy (_InputIter, _InputIter, _OutputIter) [with _InputIter = CanShu **, _OutputIter = CanShu **]'
/usr/include/g++-3/stl_deque.h:1629: instantiated from `deque::_M_reallocate_map (unsigned int, bool) [with _Tp = CanShu, _Alloc = allocator, unsigned int __bufsiz = 0]'
/usr/include/g++-3/stl_deque.h:925: instantiated from `deque::_M_reserve_map_at_front (unsigned int) [with _Tp = CanShu, _Alloc = allocator, unsigned int __bufsiz = 0]'
/usr/include/g++-3/stl_deque.h:1580: instantiated from `deque::_M_new_elements_at_front (unsigned int) [with _Tp = CanShu, _Alloc = allocator, unsigned int __bufsiz = 0]'
/usr/include/g++-3/stl_deque.h:898: instantiated from `deque::_M_reserve_elements_at_front (unsigned int) [with _Tp = CanShu, _Alloc = allocator, unsigned int __bufsiz = 0]'
/usr/include/g++-3/stl_deque.h:1256: instantiated from `deque::insert (typename _Deque_base::iterator, _ForwardIterator, _ForwardIterator, forward_iterator_tag) [with _ForwardIterator = _Deque_iterator, _Tp = CanShu, _Alloc = allocator, unsigned int __bufsiz = 0]'
/usr/include/g++-3/stl_deque.h:791: instantiated from `deque::_M_insert_dispatch (typename _Deque_base::iterator, _InputIterator, _InputIterator, __false_type) [with _InputIterator = _Deque_iterator, _Tp = CanShu, _Alloc = allocator, unsigned int __bufsiz = 0]'
/usr/include/g++-3/stl_deque.h:778: instantiated from `deque::insert (typename _Deque_base::iterator, _InputIterator, _InputIterator) [with _InputIterator = _Deque_iterator, _Tp = CanShu, _Alloc = allocator, unsigned int __bufsiz = 0]'
/usr/include/g++-3/stl_deque.h:621: instantiated from `deque::operator= (const deque &) [with _Tp = CanShu, _Alloc = allocator, unsigned int __bufsiz = 0]'
/usr/include/g++-3/stl_algobase.h:139: instantiated from `__copy (_RandomAccessIter, _RandomAccessIter, _OutputIter, random_access_iterator_tag, _Distance *) [with _RandomAccessIter = _Deque_iterator, _OutputIter = _Deque_iterator, _Distance = ptrdiff_t]'
/usr/include/g++-3/stl_algobase.h:161: instantiated from `__copy_dispatch::copy (_InputIter, _InputIter, _OutputIter) [with _InputIter = _Deque_iterator, _OutputIter = _Deque_iterator, _BoolType = __false_type]'
/usr/include/g++-3/stl_algobase.h:188: instantiated from `copy (_InputIter, _InputIter, _OutputIter) [with _InputIter = _Deque_iterator, _OutputIter = _Deque_iterator]'
/usr/include/g++-3/stl_deque.h:617: instantiated from `deque::operator= (const deque &) [with _Tp = Command, _Alloc = allocator, unsigned int __bufsiz = 0]'
/usr/include/g++-3/stl_algobase.h:139: instantiated from `__copy (_RandomAccessIter, _RandomAccessIter, _OutputIter, random_access_iterator_tag, _Distance *) [with _RandomAccessIter = _Deque_iterator, _OutputIter = _Deque_iterator, _Distance = ptrdiff_t]'
/usr/include/g++-3/stl_algobase.h:161: instantiated from `__copy_dispatch::copy (_InputIter, _InputIter, _OutputIter) [with _InputIter = _Deque_iterator, _OutputIter = _Deque_iterator, _BoolType = __false_type]'
/usr/include/g++-3/stl_algobase.h:188: instantiated from `copy (_InputIter, _InputIter, _OutputIter) [with _InputIter = _Deque_iterator, _OutputIter = _Deque_iterator]'
/usr/include/g++-3/stl_deque.h:617: instantiated from `deque::operator= (const deque &) [with _Tp = MsnUser, _Alloc = allocator, unsigned int __bufsiz = 0]'
msnuser2.cpp:565: instantiated from here
/usr/include/g++-3/stl_algobase.h:184: invalid use of undefined type
`struct iterator_traits'
/usr/include/g++-3/stl_iterator.h:101: forward declaration of `struct
iterator_traits'
/usr/include/g++-3/stl_algobase.h:186: template instantiation depth
exceeds maximum of 17 (use -ftemplate-depth-NN to increase the maximum)
instantiating `struct iterator_traits'
/usr/include/g++-3/stl_algobase.h:186: instantiated from `copy (_InputIter, _InputIter, _OutputIter) [with _InputIter = CanShu **, _OutputIter = CanShu **]'
/usr/include/g++-3/stl_deque.h:1629: instantiated from `deque::_M_reallocate_map (unsigned int, bool) [with _Tp = CanShu, _Alloc = allocator, unsigned int __bufsiz = 0]'
/usr/include/g++-3/stl_deque.h:925: instantiated from `deque::_M_reserve_map_at_front (unsigned int) [with _Tp = CanShu, _Alloc = allocator, unsigned int __bufsiz = 0]'
/usr/include/g++-3/stl_deque.h:1580: instantiated from `deque::_M_new_elements_at_front (unsigned int) [with _Tp = CanShu, _Alloc = allocator, unsigned int __bufsiz = 0]'
/usr/include/g++-3/stl_deque.h:898: instantiated from
...........

/usr/include/g++-3/stl_algobase.h:291: template argument 1 is invalid
/usr/include/g++-3/stl_algobase.h:291: template argument 3 is invalid
gmake: *** [msnuser2.o] Error 1
*** failed ***

怎么都试标准库里的 不是我的代码呢?

环境试linux ad server 3
这个代码在 redhat 7.3 freebsd 5.4 fc3.0 里面都没有问题的
在这里有这个问题
...全文
717 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
deutsch 2005-12-02
  • 打赏
  • 举报
回复
stl确实不容易出错,不过我也编译过很多的程序,只要用到了std就很容易出现一大堆错误提示,这也是template的一大特色啊
stanley_yue 2005-12-02
  • 打赏
  • 举报
回复
贴msnuser2.cpp文件
benjiam 2005-12-02
  • 打赏
  • 举报
回复
代码很多诶 200K 左右贴那一个?
Jinhao 2005-12-01
  • 打赏
  • 举报
回复
应该把代码弄出来瞧瞧
Jinhao 2005-12-01
  • 打赏
  • 举报
回复
template instantiation depth exceeds maximum of 17!!!

也许一不小心就搞了个编译的死循环
benjiam 2005-12-01
  • 打赏
  • 举报
回复
up
benjiam 2005-12-01
  • 打赏
  • 举报
回复
问题是我的代码 没用过模板亚


usr/include/g++-3/stl_algobase.h: In function `_OutputIter copy
(_InputIter, _InputIter, _OutputIter) [with _InputIter = CanShu **,
_OutputIter = CanShu **]':
/usr/include/g++-3/stl_algobase.h:184: template instantiation depth
exceeds maximum of 17 (use -ftemplate-depth-NN to increase the maximum)
instantiating `struct iterator_traits'
stanley_yue 2005-12-01
  • 打赏
  • 举报
回复
仔细看看你的代码是不是模板嵌套太多了,还有<< >>,嵌套模板的时候记得空个空格。
< < > >

这种错,肯定是你的代码的问题,不用怀疑操作系统自带的东西。它们出错的概率小多了。
sinall 2005-11-29
  • 打赏
  • 举报
回复
呵呵,STL有多个版本,不同平台有不同的实现……
Linux 简介Linux 内核最初只是由芬兰人林纳斯·托瓦兹(Linus Torvalds)在赫尔辛基大学上学时出于个人爱好而编写的。Linux 是一套免费使用和自由传播的类 Unix 操作系统,是一个基于 POSIX 和 UNIX 的多用户、多任务、支持多线程和多 CPU 的操作系统。Linux 能运行主要的 UNIX 工具软件、应用程序和网络协议。它支持 32 位和 64 位硬件。Linux 继承了 Unix 以网络为核心的设计思想,是一个性能稳定的多用户网络操作系统。Linux 的发行版Linux 的发行版说简单点就是将 Linux 内核与应用软件做一个打包。目前市面上较知名的发行版有:Ubuntu、RedHat、CentOS、Debian、Fedora、SuSE、OpenSUSE、Arch Linux、SolusOS 等。Linux 应用领域今天各种场合都有使用各种 Linux 发行版,从嵌入式设备到超级计算机,并且在服务器领域确定了地位,通常服务器使用 LAMP(Linux + Apache + MySQL + PHP)或 LNMP(Linux + Nginx+ MySQL + PHP)组合。目前 Linux 不仅在家庭与企业中使用,并且在政府中也很受欢迎。巴西联邦政府由于支持 Linux 而世界闻名。有新闻报道俄罗斯军队自己制造的 Linux 发布版的,做为 G.H.ost 项目已经取得成果。印度的 Kerala 联邦计划在向全联邦的高中推广使用 Linux。中华人民共和国为取得技术独立,在龙芯处理器中排他性地使用 Linux。在西班牙的一些地区开发了自己的 Linux 发布版,并且在政府与教育领域广泛使用,如 Extremadura 地区的 gnuLinEx 和 Andalusia 地区的 Guadalinex。葡萄牙同样使用自己的 Linux 发布版 Caixa Mágica,用于 Magalh?es 笔记本电脑和 e-escola 政府软件。法国和德国同样开始逐步采用 Linux。Linux vs Windows目前国内 Linux 更多的是应用于服务器上,而桌面操作系统更多使用的是 Windows。主要区别如下比较WindowsLinux界面界面统一,外壳程序固定所有 Windows 程序菜单几乎一致,快捷键也几乎相同图形界面风格依发布版不同而不同,可能互不兼容。GNU/Linux 的终端机是从 UNIX 传承下来,基本命令和操作方法也几乎一致。驱动程序驱动程序丰富,版本更新频繁。默认安装程序里面一般包含有该版本发布时流行的硬件驱动程序,之后所出的新硬件驱动依赖于硬件厂商提供。对于一些老硬件,如果没有了原配的驱动有时很难支持。另外,有时硬件厂商未提供所需版本的 Windows 下的驱动,也会比较头痛。由志愿者开发,由 Linux 核心开发小组发布,很多硬件厂商基于版权考虑并未提供驱动程序,尽管多数无需手动安装,但是涉及安装则相对复杂,使得新用户面对驱动程序问题(是否存在和安装方法)会一筹莫展。但是在开源开发模式下,许多老硬件尽管在Windows下很难支持的也容易找到驱动。HP、Intel、AMD 等硬件厂商逐步不同程度支持开源驱动,问题正在得到缓解。使用使用比较简单,容易入门。图形化界面对没有计算机背景知识的用户使用十分有利。图形界面使用简单,容易入门。文字界面,需要学习才能掌握。学习系统构造复杂、变化频繁,且知识、技能淘汰快,深入学习困难。系统构造简单、稳定,且知识、技能传承性好,深入学习相对容易。软件每一种特定功能可能都需要商业软件的支持,需要购买相应的授权。大部分软件都可以自由获取,同样功能的软件选择较少。Shell 脚本Shell 脚本(shell script),是一种为 shell 编写的脚本程序。业界所说的 shell 通常都是指 shell 脚本,但读者朋友要知道,shell 和 shell script 是两个不同的概念。由于习惯的原因,简洁起见,本文出现的 shell编程 都是指 shell 脚本编程,不是指开发 shell 自身。Shell 环境Shell 编程跟 JavaScript、php 编程一样,只要有一个能编写代码的文本编辑器和一个能解释执行的脚本解释器就可以了。Linux 的 Shell 种类众多,常见的有:Bourne Shell(/usr/bin/sh或/bin/sh)Bourne Again Shell(/bin/bash)C Shell(/usr/bin/csh)K Shell(/usr/bin/ksh)Shell for Root(/sbin/sh)……本教程关注的是 Bash,也就是 Bourne Again Shell,由于易用和免费,Bash 在日常工作中被广泛使用。同时,Bash 也是大多数Linux 系统默认的 Shell。在一般情况下,人们并不区分 Bourne Shell 和 Bourne Again Shell,所以,像 #!/bin/sh,它同样也可以改为 #!/bin/bash。#! 告诉系统其后路径所指定的程序即是解释此脚本文件的 Shell 程序。第一个shell脚本打开文本编辑器(可以使用 vi/vim 命令来创建文件),新建一个文件 test.sh,扩展名为 sh(sh代表shell),扩展名并不影响脚本执行,见名知意就好,如果你用 php 写 shell 脚本,扩展名就用 php 好了。输入一些代码,第一行一般是这样:实例#!/bin/bashecho Hello World !

64,648

社区成员

发帖
与我相关
我的任务
社区描述
C++ 语言相关问题讨论,技术干货分享,前沿动态等
c++ 技术论坛(原bbs)
社区管理员
  • C++ 语言社区
  • encoderlee
  • paschen
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
  1. 请不要发布与C++技术无关的贴子
  2. 请不要发布与技术无关的招聘、广告的帖子
  3. 请尽可能的描述清楚你的问题,如果涉及到代码请尽可能的格式化一下

试试用AI创作助手写篇文章吧