C++ 中能包含 #include吗?

freeskyo 2008-10-16 10:39:21
C++ 中能包含 #include<curses.h>吗?
还在序编译时,检测到 /opt/aCC/include/tree 下有许多重载的erase函数,而在
#include <curses.h> 下也有 erase 的定义,就报了下面的错误!如果不包含#include <curses.h>头文件是可以编译得过的,但我现在要用的就是#include <curses.h>包下的函数! 该怎么办呢?


下面是报的错误!
Warning 134: "/opt/aCC/include/tree", line 759 # Expected 0 arguments for macro 'erase'.
erase(begin(), end());
^^^^^
Warning 134: "/opt/aCC/include/tree", line 866 # Expected 0 arguments for macro 'erase'.
iterator erase (iterator position);
^^^^^
Error 20: "/opt/aCC/include/tree", line 866 # ' <type name>' expected before '('.
iterator erase (iterator position);
^^^^^
Error 24: "/opt/aCC/include/tree", line 866 # ' <type name>' expected instead of '0'.
iterator erase (iterator position);
^^^^^
Error 24: "/opt/aCC/include/tree", line 866 # ' <type name>' expected instead of '0'.
iterator erase (iterator position);
^^^^^
Error 21: "/opt/aCC/include/tree", line 866 # ')' expected before ')' to close scope.
iterator erase (iterator position);
^^^^^
Error 419: "/opt/aCC/include/tree", line 866 # 'stdscr' is used as a type, but has not been defined as a type.
iterator erase (iterator position);
^^^^^
Warning 134: "/opt/aCC/include/tree", line 867 # Expected 0 arguments for macro 'erase'.
size_type erase (const key_type& x);
^^^^^
Error 19: "/opt/aCC/include/tree", line 866 # Unexpected ')'.
iterator erase (iterator position);
^^^^^
Error 20: "/opt/aCC/include/tree", line 867 # ' <type name>' expected before '('.
size_type erase (const key_type& x);
^^^^^
Error 24: "/opt/aCC/include/tree", line 867 # ' <type name>' expected instead of '0'.
size_type erase (const key_type& x);
^^^^^
Error 24: "/opt/aCC/include/tree", line 867 # ' <type name>' expected instead of '0'.
size_type erase (const key_type& x);
^^^^^
Error 21: "/opt/aCC/include/tree", line 867 # ')' expected before ')' to close scope.
size_type erase (const key_type& x);
^^^^^
Error 285: "/opt/aCC/include/tree", line 867 # Functions that differ only in return type may not have the same name;
"#5::size_type rb_tree::wmove(int,int,int)" was previously declared to return "class iterator" at ["/opt/aCC/include/tree",
line 866].
size_type erase (const key_type& x);
^^^^^
Error 419: "/opt/aCC/include/tree", line 867 # 'stdscr' is used as a type, but has not been defined as a type.
size_type erase (const key_type& x);
^^^^^
Error 699: "/opt/aCC/include/tree", line 867 # Error limit reached; halting compilation.
size_type erase (const key_type& x);


下面是我在Unix 下 打 man erase 查出的信息: 高手帮忙看一下呀:谢谢

clear(3X) clear(3X)
CURSES

NAME
clear, erase, wclear, werase - clear a window

SYNOPSIS
#include <curses.h>

int clear(void);

int erase(void);

int wclear(WINDOW *win);

int werase(WINDOW *win);

DESCRIPTION
The clear(), erase(), wclear() and werase() functions clear every
position in the current or specified window.
...全文
445 10 打赏 收藏 转发到动态 举报
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
heroesyao 2011-05-02
  • 打赏
  • 举报
回复
学习了,感谢~~~~
freeskyo 2008-10-19
  • 打赏
  • 举报
回复
找到一种方法,是别人提供的,共享之

myspace.h

namespace myspace {

#include<curses.h>

}

.App.cpp

#include "space.h"

int main()
{
myspace::erase();
}
freeskyo 2008-10-17
  • 打赏
  • 举报
回复
这个方法肯定不行,注释掉能通过,但最终还是要用的
[Quote=引用 7 楼 zmlovelx 的回复:]
不知道能不能先把
int erase(void); 声明与定义先注释掉
编译连接后再去年注释
[/Quote]
jufeng2309 2008-10-16
  • 打赏
  • 举报
回复
-I/opt/aCC/include/tree
jufeng2309 2008-10-16
  • 打赏
  • 举报
回复
-I/opt/aCC/include/tree
jufeng2309 2008-10-16
  • 打赏
  • 举报
回复
编译的时候重新对头文件进行指定下
-I//opt/aCC/include/tree
freeskyo 2008-10-16
  • 打赏
  • 举报
回复
都是各自的系统包含, 不是我编的程序!
快乐田伯光 2008-10-16
  • 打赏
  • 举报
回复
有不同的命名空间吗?调用前加std试试.
帅得不敢出门 2008-10-16
  • 打赏
  • 举报
回复
不知道能不能先把
int erase(void); 声明与定义先注释掉
编译连接后再去年注释
freeskyo 2008-10-16
  • 打赏
  • 举报
回复

[Quote=引用 5 楼 jufeng2309 的回复:]
-I/opt/aCC/include/tree
[/Quote]

这样包含是什么意思呀,能解决吗?

23,121

社区成员

发帖
与我相关
我的任务
社区描述
Linux/Unix社区 应用程序开发区
社区管理员
  • 应用程序开发区社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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