ERROR C2676
直接上代码:
nl.h
#ifndef NL_H
#define NL_H #include <iosfwd> namespace ZJ
{
/**
Insert a newline character '\n'
without flushing the ostream
*/
std::ostream& nl(std::ostream& os);
} #endif // NL_H
nl.cpp
#include "nl.h" using namespace std; ostream& ZJ::nl(ostream& os)
{
return os << '\n';
}
main.cpp
#include "nl.h" #include <iostream> using namespace ZJ;
using namespace std; int main()
{
cout << "newlines"<< nl << "between"<< nl
<< "each"<< nl << "word"<< endl;
cout << "................................"; return ;
}
报错:
nl.cpp
src\nl.cpp(7) : error C2676: 二进制“<<”:“std::ostream”不定义该运算符或到预定义运算符可接收的类型的转换
原因:
nl.h中的#include <iosfwd>换成#include <iostream>
ERROR C2676的更多相关文章
- could not deduce template argument for 'const std::_Tree<_Traits> &' from 'const std::string'
VS2008, 写一个简单的demo的时候出现了这个: 1>------ Build started: Project: GetExportTable, Configuration: Relea ...
- C++学习之重载运算符1
C++除可重载函数之后,还允许定义已有的运算符,这样通过运算符重载可像处理数据使用它们. 先来个代码 #include<iostream> using namespace std; cla ...
- C语言常见错误中英文对照表
C语言常见错误中英文对照表(网络搜索及经验积累不断更新中) 常见错误中英文对照表 fatal error C1003: error count exceeds number; stopping co ...
- STL中map错误用法一例
[GBK]0G's fans( me ) 13:34:26typedef struct _TX_DATA{ int len; unsigned char buff[0x100]; } TX_DATA, ...
- C语言开发中常见报错的解决方案
C语言开发中常见报错的解决方案 整理来源于网络,侵权请通知删除.*禁止转载 ---- fatal error C1003: error count exceeds number; stopping c ...
- C++20初体验——concepts
引子 凡是涉及STL的错误都不堪入目,因为首先STL中有复杂的层次关系,在错误信息中都会暴露出来,其次这么多类和函数的名字大多都是双下划线开头的,一般人看得不习惯. 一个经典的错误是给std::sor ...
- Mediaplayer error (-19,0)
Android MediaPlayer 发生 error (-19,0) 错误解决方法. 引起原因:由于多次实例化MediaPlayer.start() 进行播放操作引起的.由于没有及时释放内存资源导 ...
- 4.Android 打包时出现的Android Export aborted because fatal error were founds [closed]
Android 程序开发完成后,如果要发布到互联网上供别人使用,就需要将自己的程序打包成Android 安装包文件(Android Package,APK),其扩展名为.apk.使用run as 也能 ...
- myeclipse 内存不够用报错PermGen space 和 An internal error has occurred.
最近项目中又增加了新的模块,项目的代码又多了不少.运行的时候总是报如下错误 Exception in thread "http-apr-80-exec-6" java.lang.O ...
随机推荐
- 【C#】:浅谈反射机制 【转】
http://blog.csdn.net/lianjiangwei/article/details/47207875 什么是反射? 反射提供了封装程序集.模块和类型的对象(Type 类型).可以使用反 ...
- MFC【17-2】线程和线程同步化
17-2线程同步 Windows支持4中类型的同步对象,可以用过来同步由并发运行的线程执行的操作: 临界区 互斥量 事件 信号量 MFC在名为CCriticalSection\CMutex\CEven ...
- java缓存适合使用的情况
并非所有的情况都适合于使用二级缓存,需要根据具体情况来决定.同时可以针对某一个持久化对象配置其具体的缓存策略. 适合于使用二级缓存的情况: 1.数据不会被第三方修改 一般情况下,会被hibernate ...
- 转:关于android webview实践的文章集合
http://blog.csdn.net/jiangqq781931404/article/category/2681765
- 在weblogic上配置数据源
转自:http://blog.csdn.net/weijie_search/article/details/2756585 旁白 这是在weblogic9.0+mysql5.1的环境下配置的数据源.其 ...
- EXCEL在使用中,jar导入问题
报错:The type org.apache.poi.ss.usermodel.Workbook cannot be resolved. It is indirectly referenced fro ...
- win7之64位下安装oracle11g遇到问题和不能删除干净的问题
今天在win7下装了oracle11g 删了又卸 来来回回重启了4.5次,结合网上是解释归纳下几点: 一.win64_11gR2_database_1of2.zip和win64_11gR2_datab ...
- pip运行报错Fatal error in launcher: Unable to create process using pip.exe
使用pip的时候报错Fatal error in launcher: Unable to create process using pip.exe 解决办法,升级pip python -m pip i ...
- linux修改密码出现Authentication token manipulation error的解决办法
转自 :http://blog.163.com/junwu_lb/blog/static/1916798920120103647199/ Authentication token manipulati ...
- android项目解刨之时间轴
近期开发的app中要用到时间轴这东西.须要实现的效果例如以下: 想想这个东西应该能够用listview实现吧. 然后近期就模拟着去写了: 首先写 listview的item的布局: listview ...