C++之父新作里#include"std_lib_facilities.h"

dixiad 2010-09-27 09:19:24
#include"std_lib_facilities.h"是什么头文件那?在c free里说找不到这个文件
...全文
1016 15 打赏 收藏 转发到动态 举报
写回复
用AI写文章
15 条回复
切换为时间正序
请发表友善的回复…
发表回复
ForestDB 2010-09-28
  • 打赏
  • 举报
回复
LZ一定是看书的时候跳着看的。
书中有下载的地址。
hongwenjun 2010-09-28
  • 打赏
  • 举报
回复
"xxx.h" 基本就是自定义了
<xxxxxx> C++编译带的库
或者 安装的其他库
dixiad 2010-09-28
  • 打赏
  • 举报
回复
[Quote=引用 13 楼 binbin1129 的回复:]
楼主大哥。。。
这本书叫什么名???
[/Quote]
Programming -- Principles and Practice Using C++
中文版叫c++程序设计原理与实践
binbin1129 2010-09-28
  • 打赏
  • 举报
回复
楼主大哥。。。
这本书叫什么名???
dixiad 2010-09-28
  • 打赏
  • 举报
回复
[Quote=引用 11 楼 forestdb 的回复:]
LZ一定是看书的时候跳着看的。
书中有下载的地址。
[/Quote]
嗯,我是跳着看的
Rainqin123 2010-09-27
  • 打赏
  • 举报
回复
全错.....比如#include“stdafx.h"(大概是这样)控制台程序少了它一点都不行....
dixiad 2010-09-27
  • 打赏
  • 举报
回复
那不是没它的光盘就没法用了?
GARY 2010-09-27
  • 打赏
  • 举报
回复
[Quote=引用 2 楼 hslinux 的回复:]
没见过这个文件,一般来说
<XXXX.h>,也就是中括号括起来的头文件是系统路径中存在的头文件,
"XXXX.h",也就是双引号引用的头文件为用户项目中自定义的头文件。

所以LZ说的文件有可能是C++之父这个牛人自定义的一个头文件。。。。。。
[/Quote]
楼上所言极是。
hslinux 2010-09-27
  • 打赏
  • 举报
回复
没见过这个文件,一般来说
<XXXX.h>,也就是中括号括起来的头文件是系统路径中存在的头文件,
"XXXX.h",也就是双引号引用的头文件为用户项目中自定义的头文件。

所以LZ说的文件有可能是C++之父这个牛人自定义的一个头文件。。。。。。
  • 打赏
  • 举报
回复
是他自己定义的头文件
ericming200409 2010-09-27
  • 打赏
  • 举报
回复
楼主需要补充一下对头文件的理解咯
1 头文件是在预处理的时候才有的概念,预处理器将头文件包含到相应位置,对于编译器来讲,是没有头文件这个概念的。
2 请注意#include<XXX.h> 和 #include "XXX.h"的区别,对于这两种包含头文件的方式,预处理器的搜索方式不一样,""方式下是会先搜索当前目录的,所以一般标示为""的都可以考虑是不是在当然目录,当然也可以不是在当前目录,但是如果是标准库之类的,一般都是用<>,因为没必要先搜索当前目录浪费时间嘛
dixiad 2010-09-27
  • 打赏
  • 举报
回复
这个是stroustrup主页的std_lib_facilities.h文件

/*
simple "Programming: Principles and Practice using C++" course header to
be used for the first few weeks.
It provides the most common standard headers (in the global namespace)
and minimal exception/error support.

Students: please don't try to understand the details of headers just yet.
All will be explained. This header is primarily used so that you don't have
to understand every concept all at once.

Revised April 25, 2010: simple_error() added
*/

#ifndef H112
#define H112 201004L

#include<iostream>
#include<fstream>
#include<sstream>
#include<cmath>
#include<cstdlib>
#include<string>
#include<list>
#include<vector>
#include<algorithm>
#include<stdexcept>

//------------------------------------------------------------------------------

#ifdef _MSC_VER
#include <hash_map>
using stdext::hash_map;
#else
#include <ext/hash_map>
using __gnu_cxx::hash_map;

namespace __gnu_cxx {

template<> struct hash<std::string>
{
size_t operator()(const std::string& s) const
{
return hash<char*>()(s.c_str());
}
};

} // of namespace __gnu_cxx
#endif

//------------------------------------------------------------------------------

#define unordered_map hash_map

//------------------------------------------------------------------------------

typedef long Unicode;

//------------------------------------------------------------------------------

using namespace std;

template<class T> string to_string(const T& t)
{
ostringstream os;
os << t;
return os.str();
}

struct Range_error : out_of_range { // enhanced vector range error reporting
int index;
Range_error(int i) :out_of_range("Range error: "+to_string(i)), index(i) { }
};


// trivially range-checked vector (no iterator checking):
template< class T> struct Vector : public std::vector<T> {
typedef typename std::vector<T>::size_type size_type;

Vector() { }
explicit Vector(size_type n) :std::vector<T>(n) {}
Vector(size_type n, const T& v) :std::vector<T>(n,v) {}
template <class I>
Vector(I first, I last) :std::vector<T>(first,last) {}

T& operator[](unsigned int i) // rather than return at(i);
{
if (i<0||this->size()<=i) throw Range_error(i);
return std::vector<T>::operator[](i);
}
const T& operator[](unsigned int i) const
{
if (i<0||this->size()<=i) throw Range_error(i);
return std::vector<T>::operator[](i);
}
};

// disgusting macro hack to get a range checked vector:
#define vector Vector

// trivially range-checked string (no iterator checking):
struct String : std::string {

String() { }
String(const char* p) :std::string(p) {}
String(const string& s) :std::string(s) {}
template<class S> String(S s) :std::string(s) {}
String(int sz, char val) :std::string(sz,val) {}
template<class Iter> String(Iter p1, Iter p2) : std::string(p1,p2) { }

char& operator[](unsigned int i) // rather than return at(i);
{
if (i<0||size()<=i) throw Range_error(i);
return std::string::operator[](i);
}

const char& operator[](unsigned int i) const
{
if (i<0||size()<=i) throw Range_error(i);
return std::string::operator[](i);
}
};

#ifndef _MSC_VER
namespace __gnu_cxx {

template<> struct hash<String>
{
size_t operator()(const String& s) const
{
return hash<std::string>()(s);
}
};

} // of namespace __gnu_cxx
#endif


struct Exit : runtime_error {
Exit(): runtime_error("Exit") {}
};

// error() simply disguises throws:
inline void error(const string& s)
{
throw runtime_error(s);
}

inline void error(const string& s, const string& s2)
{
error(s+s2);
}

inline void error(const string& s, int i)
{
ostringstream os;
os << s <<": " << i;
error(os.str());
}

#if _MSC_VER<1500
// disgusting macro hack to get a range checked string:
#define string String
// MS C++ 9.0 have a built-in assert for string range check
// and uses "std::string" in several places so that macro substitution fails
#endif

template<class T> char* as_bytes(T& i) // needed for binary I/O
{
void* addr = &i; // get the address of the first byte
// of memory used to store the object
return static_cast<char*>(addr); // treat that memory as bytes
}


inline void keep_window_open()
{
cin.clear();
cout << "Please enter a character to exit\n";
char ch;
cin >> ch;
return;
}

inline void keep_window_open(string s)
{
if (s=="") return;
cin.clear();
cin.ignore(120,'\n');
for (;;) {
cout << "Please enter " << s << " to exit\n";
string ss;
while (cin >> ss && ss!=s)
cout << "Please enter " << s << " to exit\n";
return;
}
}



// error function to be used (only) until error() is introduced in Chapter 5:
inline void simple_error(string s) // write ``error: s?? and exit program
{
cerr << "error: " << s << '\n';
keep_window_open(); // for some Windows environments
exit(1);
}

// make std::min() and std::max() accessible:
#undef min
#undef max

#include<iomanip>
inline ios_base& general(ios_base& b) // to augment fixed and scientific
{
b.setf(ios_base::fmtflags(0),ios_base::floatfield);
return b;
}

// run-time checked narrowing cast (type conversion):
template<class R, class A> R narrow_cast(const A& a)
{
R r = R(a);
if (A(r)!=a) error(string("info loss"));
return r;
}


inline int randint(int max) { return rand()%max; }

inline int randint(int min, int max) { return randint(max-min)+min; }

inline double sqrt(int x) { return sqrt(double(x)); } // to match C++0x

#endif


我把它与我的程序放在一个文件夹里编译运行时没问题,可是退出cfree时却总是出现内存不可read的错误不知是何缘故,用cfree的朋友请帮我测试下
baisoo 2010-09-27
  • 打赏
  • 举报
回复
路过,1:每天在论坛回复可以得10分;
dixiad 2010-09-27
  • 打赏
  • 举报
回复
我找到了这个文件,可是不知道把它放在哪,难道每建一个工程都加入这个文件?c free是去哪个目录找这类自定义头文件的?
VC6下安装与配置 Wikipedia,自由的百科全书 本手册适应 OpenCV 1.0 安装。 目录 [隐藏] 1 安装Visual C++ 6.0 2 安装OpenCV 3 配置Windows环境变量 4 配置Visual C++ 6.0 4.1 全局设置 4.2 项目设置 [编辑]安装Visual C++ 6.0 略。 [编辑]安装OpenCV 从http://www.opencv.org.cn/ 下载OpenCV安装程序。假如要将OpenCV安装到C:\\Program Files\\OpenCV。(下面附图为OpenCV 1.0rc1的安装界面,OpenCV 1.0安装界面与此基本一致。)在安装时选择\"将\\OpenCV\\bin加入系统变量\"(Add\\OpenCV\\bin to the systerm PATH)。 [编辑]配置Windows环境变量 检查C:\\Program Files\\OpenCV\\bin是否已经被加入到环境变量PATH,如果没有,请加入。 [编辑]配置Visual C++ 6.0 [编辑]全局设置 菜单Tools->Options->Directories:先设置lib路径,选择Library files,在下方填入路径: C:\\Program Files\\OpenCV\\lib 然后选择include files,在下方填入路径: C:\\Program Files\\OpenCV\\cxcore\\include C:\\Program Files\\OpenCV\\cv\\include C:\\Program Files\\OpenCV\\cvaux\\include C:\\Program Files\\OpenCV\\ml\\include C:\\Program Files\\OpenCV\\otherlibs\\highgui C:\\Program Files\\OpenCV\\otherlibs\\cvcam\\include [编辑]项目设置 每创建一个将要使用OpenCV的VC Project,都需要给它指定需要的lib。菜单:Project->Settings,然后将Setting for选为All Configurations,然后选择右边的link标签,在Object/library modules附加上 cxcore.lib cv.lib ml.lib cvaux.lib highgui.lib cvcam.lib 如果你不需要这么多lib,你可以只添加你需要的lib
DirectX修复工具(DirectX Repair)是一款系统级工具软件,简便易用。本程序为绿色版,无需安装,可直接运行。 本程序的主要功能是检测当前系统的DirectX状态,如果发现异常则进行修复。程序主要针对0xc000007b问题设计,可以完美修复该问题。本程序中包含了最新版的DirectX redist(Jun2010),并且全部DX文件都有Microsoft的数字签名,安全放心。 本程序为了应对一般电脑用户的使用,采用了傻瓜式一键设计,只要点击主界面上的“检测并修复”按钮,程序就会自动完成校验、检测、下载、修复以及注册的全部功能,无需用户的介入,大大降低了使用难度。 本程序适用于多个操作系统,如Windows XP(需先安装.NET 2.0,详情请参阅“致Windows XP用户.txt”文件)、Windows Vista、Windows 7、Windows 8、Windows 8.1、Windows 8.1 Update、Windows 10,同时兼容32位操作系统和64位操作系统。本程序会根据系统的不同,自动调整任务模式,无需用户进行设置。 本程序的V3.3版分为标准版、增强版以及在线修复版。其中的标准版以及增强版都包含完整的DirectX组件。除此之外,增强版中还额外包含了c++ Redistributable Package,因此增强版不但能解决DirectX组件的问题,而且还能解决c++组件异常产生的问题。增强版适合无法自行解决c++相关问题的用户使用。在线修复版的功能与标准版相同,只是其所需的文件将通过Internet下载,因此大大减小了程序的体积。本程序的各个版本之间,主程序完全相同,只是配套使用的数据包不同。因此,当您使用标准版数据包时,程序将进行标准修复;当您使用增强版的数据包时,程序将进行增强修复;当数据包不全或没有数据包(即只有DirectX Repair.exe程序)时,程序将进行在线修复。在线修复、离线修复可自由灵活组合,充分满足不同用户的需要。 本程序自V2.0版起采用全新的底层程序架构,使用了异步多线程编程技术,使得检测、下载、修复单独进行,互不干扰,快速如飞。新程序更改了自我校验方式,因此使用新版本的程序时不会再出现自我校验失败的错误;但并非取消自我校验,因此程序安全性与之前版本相同,并未降低。 程序有自动更新c++功能。由于绝大多数软件运行时需要c++的支持,并且c++的异常也会导致0xc000007b错误,因此程序在检测修复的同时,也会根据需要更新系统中的c++组件。自V3.2版本开始使用了全新的c++扩展包,可以大幅提高工业软件修复成功的概率。修复c++的功能仅限于增强版,标准版及在线修复版在系统c++异常时(非丢失时)会提示用户使用增强版进行修复。 程序有两种窗口样式。正常模式即默认样式,适合绝大多数用户使用。另有一种简约模式,此时窗口将只显示最基本的内容,修复会自动进行,修复完成10秒钟后会自动退出。该窗口样式可以使修复工作变得更加简单快速,同时方便其他软件、游戏将本程序内嵌,即可进行无需人工参与的快速修复。开启简约模式的方法是:打开程序所在目录下的“Settings.ini”文件(如果没有可以自己创建),将其中的“FormStyle”一项的值改为“Simple”并保存即可。 程序有高级筛选功能,开启该功能后用户可以自主选择要修复的文件,避免了其他不必要的修复工作。同时,也支持通过文件进行辅助筛选,只要在程序目录下建立“Filter.dat”文件,其中的每一行写一个需要修复文件的序号即可。该功能仅针对高级用户使用,并且必须在正常窗口模式下才有效(简约模式时无效)。 本程序有自动记录日志功能,可以记录每一次检测修复结果,方便在出现问题时,及时分析和查找原因,以便找到解决办法。 程序的“选项”对话框中包含了4项高级功能。点击其中的“注册系统文件夹中所有dll文件”按钮可以自动注册系统文件夹下的所有dll文件。该项功能不仅能修复DirectX的问题,还可以修复系统中很多其他由于dll未注册而产生的问题,颇为实用。点击该按钮旁边的小箭头,还可以注册任意指定文件夹下的dll文件,方便用户对绿色版、硬盘版的程序组件进行注册。点击第二个按钮可以为dll文件的右键菜单添加“注册”和“卸载”项,方便对单独的dll文件进行注册。请注意,并不是所有的dll文件都可以通过这种方式注册。点击“DirectX版本”选项卡可以自行修改系统中DirectX的版本信息。点击“DirectX加速”选项卡可以控制系统中DirectX加速的开启与关闭。 新版程序集成了用户反馈程序,可以在用户允许的前提下发送检测修复结果。用户也可以在出现问题时通过反馈程序和软件作者进行交流,共同查找问题。反馈是完全自愿和匿名(如果不填写E-mail地址)的。 本程序的通用版基于Microsoft .NET Framework 2.0开发,对于Windows 2000、Windows XP、Windows 2003的用户需要首先安装.NET Framework 2.0或更高版本方可运行本程序。有关下载和安装的详细信息请参阅“致Windows XP用户.txt”文件。对于Windows Vista、Windows 7及后续用户,可以直接运行本程序。 同时鉴于Windows 8(Windows 8.1、Windows 8.1 Update)、Windows 10系统中默认未包含.NET Framework 2.0,因此新版的程序文件夹内将包含一个DirectX_Repair_win8的特别版程序,该程序功能与通用版相同,基于.NET Framework 4.0开发,可以在Windows8(Windows 8.1、Windows 8.1 Update)、Windows 10系统中直接运行(其他系统如果安装了.NET Framework 4.0也可以运行这个特别版的程序)。 本程序的官方博客地址为:http://blog.csdn.net/vbcom/article/details/6962388 所有的更新以及技术支持都可以到该博客上找到。

65,209

社区成员

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

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