没有加using namespace std;这句的时候 #include<iostream>
#include<vector>
#include<string> string pooh_pals[] = {
"tigger","pigger"
}; int main(){
vector<string> pp(pooh_pals,pooh_pals+2);
vector<string>::iterator iter= pp.begin();
vector<string>::iterator iter_end = pp.end(); cout << "these are pp's data: ";
for( ; iter!=iter_end; iter++ )
{
cout << *iter << endl;
}
return 0;
} 编译的时候报下面的错误:
Compiling...
f1.cpp
d:\vc\protest\f1.cpp(5) : error C2146: syntax error : missing ';' before identifier 'pooh_pals'
d:\vc\protest\f1.cpp(5) : error C2501: 'string' : missing storage-class or type specifiers
d:\vc\protest\f1.cpp(5) : fatal error C1004: unexpected end of file found
Error executing cl.exe. f1.obj - 3 error(s), 0 warning(s) 如果加上using namespace std;后编译的时候报下面的错误: Compiling...
f1.cpp
D:\vc\proTest\f1.cpp(21) : warning C4786: 'std::reverse_iterator<std::basic_string<char,std::char_traits<char>,std::allocator<char> > const *,std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::basic_string<char,std::char_trait
s<char>,std::allocator<char> > const &,std::basic_string<char,std::char_traits<char>,std::allocator<char> > const *,int>' : identifier was truncated to '255' characters in the debug information
D:\vc\proTest\f1.cpp(21) : warning C4786: 'std::reverse_iterator<std::basic_string<char,std::char_traits<char>,std::allocator<char> > *,std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::basic_string<char,std::char_traits<char
>,std::allocator<char> > &,std::basic_string<char,std::char_traits<char>,std::allocator<char> > *,int>' : identifier was truncated to '255' characters in the debug information
c:\program files\microsoft visual studio\vc98\include\vector(56) : warning C4786: 'std::vector<std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::allocator<std::basic_string<char,std::char_traits<char>,std::allocator<char> > >
>::vector<std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::allocator<std::basic_string<char,std::char_traits<char>,std::allocator<char> > > >' : identifier was truncated to '255' characters in the debug information
c:\program files\microsoft visual studio\vc98\include\vector(60) : warning C4786: 'std::vector<std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::allocator<std::basic_string<char,std::char_traits<char>,std::allocator<char> > >
>::~vector<std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::allocator<std::basic_string<char,std::char_traits<char>,std::allocator<char> > > >' : identifier was truncated to '255' characters in the debug information f1.obj - 0 error(s), 4 warning(s)
#include<vector>
#include<string> string pooh_pals[] = {
"tigger","pigger"
}; int main(){
vector<string> pp(pooh_pals,pooh_pals+2);
vector<string>::iterator iter= pp.begin();
vector<string>::iterator iter_end = pp.end(); cout << "these are pp's data: ";
for( ; iter!=iter_end; iter++ )
{
cout << *iter << endl;
}
return 0;
} 编译的时候报下面的错误:
Compiling...
f1.cpp
d:\vc\protest\f1.cpp(5) : error C2146: syntax error : missing ';' before identifier 'pooh_pals'
d:\vc\protest\f1.cpp(5) : error C2501: 'string' : missing storage-class or type specifiers
d:\vc\protest\f1.cpp(5) : fatal error C1004: unexpected end of file found
Error executing cl.exe. f1.obj - 3 error(s), 0 warning(s) 如果加上using namespace std;后编译的时候报下面的错误: Compiling...
f1.cpp
D:\vc\proTest\f1.cpp(21) : warning C4786: 'std::reverse_iterator<std::basic_string<char,std::char_traits<char>,std::allocator<char> > const *,std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::basic_string<char,std::char_trait
s<char>,std::allocator<char> > const &,std::basic_string<char,std::char_traits<char>,std::allocator<char> > const *,int>' : identifier was truncated to '255' characters in the debug information
D:\vc\proTest\f1.cpp(21) : warning C4786: 'std::reverse_iterator<std::basic_string<char,std::char_traits<char>,std::allocator<char> > *,std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::basic_string<char,std::char_traits<char
>,std::allocator<char> > &,std::basic_string<char,std::char_traits<char>,std::allocator<char> > *,int>' : identifier was truncated to '255' characters in the debug information
c:\program files\microsoft visual studio\vc98\include\vector(56) : warning C4786: 'std::vector<std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::allocator<std::basic_string<char,std::char_traits<char>,std::allocator<char> > >
>::vector<std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::allocator<std::basic_string<char,std::char_traits<char>,std::allocator<char> > > >' : identifier was truncated to '255' characters in the debug information
c:\program files\microsoft visual studio\vc98\include\vector(60) : warning C4786: 'std::vector<std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::allocator<std::basic_string<char,std::char_traits<char>,std::allocator<char> > >
>::~vector<std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::allocator<std::basic_string<char,std::char_traits<char>,std::allocator<char> > > >' : identifier was truncated to '255' characters in the debug information f1.obj - 0 error(s), 4 warning(s)
解决方案 »
- 用vs2010开发MFC类程序,无法生成可执行文件??
- 键盘消息处理函数设置了断点为何还是无法调试阿
- VC6插入语句执行不成功的困惑
- 求高手帮忙毕业设计
- 关于BCG
- TabCtrl 中放入二页page1及page2, page1有若干控件,在某一控件中敲击Enter,此时控件都不显示了?
- 一个关于线程同步的问题!
- 寻找acdsee的源码
- 请帮忙看一小段程序
- 可是我还是不知到在CListCtrl中DrawItem函数啊,该函数是怎么加进程序来的啊,是通过Add Window Message Hander...吗
- 消息映射函数问题!~~各位高手路过帮帮忙!~~
- 请教WNetAddConnection的用法
因为在编译的时候,其实是要将STL中类的名字进行展开的展开得到全名了,会太长,所以说就会将这个类的名字给截短.即identifier was truncated to '255' characters
一般不用担心.
warning可以不用管它..