//我定义的结构
struct word
{
string data;
int row;
int line;
}word,*word_ptr;typedef struct word elemtype;
//创建了一个链表
list<elemtype> l;list<elemtype>::iterator it;
for(it=l.begin();it!=l.end();it++)
{
cout<<(*it).data<<"行号:"<<(*it).row<<" 列号:"<<(*it).line<<endl;
}但是提示出错
Compiling...
file.cpp
C:\Documents and Settings\Administrator\桌面\读写文件\file.cpp(53) : error C2679: binary '<<' : no operator defined which takes a right-hand operand of type 'class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >' (o
r there is no acceptable conversion)
执行 cl.exe 时出错.file.obj - 1 error(s), 0 warning(s)
解决方案 »
- 使用映射实现图像缩放
- 大哥们帮帮忙啊!!!
- [钩子高手请进] 我在全局钩子中得到了某窗体的指针,pWnd,我将它转换为窗体源码中对应的窗口类:(CMyWnd *),可以通过这个指针访问CMyWnd窗口类的成员吗?怎么弄?多谢~!
- ________如何解决error LNK2001: unresolved external symbol_________?
- vc中format用法
- 请问高级程序员每年什么时候报名?一年考几次?报名费是多少?
- how to convert type _variant_t to type DWORD?
- MFC之DLL问题,内详
- 请问如何使用custom控件?
- 谁有关于使用COM技术开发某一具体系统的文档,倾囊相送!!!
- OGRE中的createManual和createManualObject
- vc2008 读取bmp问题 求助
#include <iostream>
#include <string>
#include <list>using namespace std;struct word
{
string data;
int row;
int line;
}word,*word_ptr;typedef struct word elemtype;int _tmain(int argc, _TCHAR* argv[])
{
list<elemtype> l; elemtype info;
info.data = "Hello";
info.row = 1;
info.line = 2; l.push_back(info);
list<elemtype>::iterator it;
for(it=l.begin();it!=l.end();it++)
{
cout<<(*it).data<<"行号:"<<(*it).row<<" 列号:"<<(*it).line<<endl;
} return 0;
}
Compiling...
045.cpp
D:\vc++\MSDev98\Bin\045.cpp(32) : error C2872: 'cout' : ambiguous symbol
D:\vc++\MSDev98\Bin\045.cpp(32) : error C2679: binary '<<' : no operator defined which takes a right-hand operand of type 'class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >' (or there is no acceptable conversion
)
执行 cl.exe 时出错.045.obj - 1 error(s), 0 warning(s)
这样的错误