在C++ man pages中查询C++的函数

本文详细介绍了如何在Linux环境下正确查询C++函数的使用方法,包括使用man命令查找函数所在的命名空间和头文件,并提供了具体的示例和步骤。避免了由于混淆操作系统、C语言与C++导致的问题。

在Linux下查询命令或函数的使用,通常是这样:

man printf

man 3 printf

man cat

但是为了避免造成操作系统、C语言与C++的混淆,目前安装的C++ man pages与上面的查询命令有一些不同,主要是加了命名空间的限定,也就是说用这样的命令 : man cout , 是查询不到的。

正确的方法应该是:

man std::iostream ,之后再通过搜索/cout,找到cout的说明

也就是说现在的查询命令应该是

man namespace::header

man 命名空间::头文件

下面是英文原文

How many times did you try on the terminal the following command and got frustrated

$ man cout

No manual entry forcout

If you have decided that there is no way you can find more about cout apart from going to web, then read the article on how to install C++ man pages?

Once you have installed the documentation, you must follow the following method to know more about the function

If you are searching about cout, you know it is part of the namespace std and defined in the headeriostream. So to search for cout, you must type

$ man std::iostream

Once the man page is open, you can search for cout.

Similarly for slist related function

$ man __gnu_cxx::slist

Thus the syntax to search any c++ man page is

$ man namespace::header

Note: The man pages are generated using doxygen. You may not much elaborate description like you get for C function.

转载于:https://my.oschina.net/u/1024767/blog/313388

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值