我正在尝试从书中获取示例代码,所以我不完全确定我到目前为止在头文件中可能有什么问题.
我一直收到以下错误消息.
错误2错误C2061:语法错误:标识符'streambuf'
错误1错误C2504:'ios':基类未定义
错误5 IntelliSense:标识符"streambuf"未定义
// StdAfx.h HEADER FILE
**************************
// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, but
// are changed infrequently
//
#pragma once
#include <iostream>
#include <strstream>
#include <iomanip>
#include <ios>
#include <stdio.h>
#include <tchar.h>
#include "targetver.h"
// Conios HEADER FILE
**************************
#include "Stdafx.h"
class Conios :virtual public ios{
protected:
public:
Conios(void);
~Conios(void);
Conios(streambuf* Buffer);
};
Run Code Online (Sandbox Code Playgroud)
ios在std-namespace中.所以要么使用,use namespace std;要么延伸std::ios而不仅仅是ios.
如果使用的是use namespace使用它只是在你实现的文件,如*.cpp或*.cxx,你不写use namespace ...你的头文件-永远!
同样的道理streambuf.
| 归档时间: |
|
| 查看次数: |
821 次 |
| 最近记录: |