#include "stdafx.h"
#include "Console1.h"#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif/////////////////////////////////////////////////////////////////////////////
// The one and only application objectCWinApp theApp;using namespace std;int _tmain(int argc, TCHAR* argv[], TCHAR* envp[])
{
int nRetCode = 0; // initialize MFC and print and error on failure
if (!AfxWinInit(::GetModuleHandle(NULL), NULL, ::GetCommandLine(), 0))
{
// TODO: change error code to suit your needs
cerr << _T("Fatal Error: MFC initialization failed") << endl;
nRetCode = 1;
}
else
{
// TODO: code your application's behavior here.
CString strHello;
strHello.LoadString(IDS_HELLO);
cout << (LPCTSTR)strHello << endl;
afxDump<<"abc"<<endl; //为什么这行错? } return nRetCode;
}error C2679: binary '<<' : no operator defined which takes a right-hand operand of type '' (or there is no acceptable conversion)
#include "Console1.h"#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif/////////////////////////////////////////////////////////////////////////////
// The one and only application objectCWinApp theApp;using namespace std;int _tmain(int argc, TCHAR* argv[], TCHAR* envp[])
{
int nRetCode = 0; // initialize MFC and print and error on failure
if (!AfxWinInit(::GetModuleHandle(NULL), NULL, ::GetCommandLine(), 0))
{
// TODO: change error code to suit your needs
cerr << _T("Fatal Error: MFC initialization failed") << endl;
nRetCode = 1;
}
else
{
// TODO: code your application's behavior here.
CString strHello;
strHello.LoadString(IDS_HELLO);
cout << (LPCTSTR)strHello << endl;
afxDump<<"abc"<<endl; //为什么这行错? } return nRetCode;
}error C2679: binary '<<' : no operator defined which takes a right-hand operand of type '' (or there is no acceptable conversion)
解决方案 »
- EnumWindows使用问题,程序崩溃!
- fread,fwrite,fseek vs CreateFile, ReadFile...
- 关于鼠标移动到任务栏上某个窗口后发送的消息
- 大家來切磋一下,一個主板生產廠家的驅動程序的源代碼,有50分哦!
- 关于ODBC写数据问题
- CWinApp::OnFileNew()||CWinApp::OnFileOpen()!
- 在服务中,监听socket端口的问题?高手请进
- 哪位高手知道在多行文本框中使滚动条的位置总是处于最下边
- 调用CView的Create()后,竟发现其m_hWnd成员值为0xdddddddd,接着,出现非法操作……
- 如何将我的控件背景变成我想要的?
- 如何在mutiline的edit 控件内输入硬回车符
- 怎样改变一个对话框的背景色??
没有用,错误一样
afxDump << endl;1. 如果afxDump跟的是iostream.h的endl,没有关系,因为相当于afxDump << ostream&; 即输出ostream的地址,因此调用afxDump << (void*)ostream&,输出象这样:$102A2770
2. 如果afxDump跟的是iostream的endl, 那就相当于把下面endl的定义带入,我也不知道什么结果:
template<class _E, class _Tr> inline
basic_ostream<_E, _Tr>&
__cdecl endl(basic_ostream<_E, _Tr>& _O)
{_O.put(_O.widen('\n'));
_O.flush();
return (_O); }