string' does not name a type 及命名空间
2014-04-03 16:02
676 查看
在做c++ primer 中习题时,发现string' does not name a type;
#include <cstdlib>
#include <iostream>
#include <string>
string sa[10];
int ia[10];
using namespace std;
int main(int argc, char *argv[])
{
string sa2[10];
int ia2[10];
for (int i=0; i!=0
cout <<*sa<<endl;
system("PAUSE");
return EXIT_SUCCESS;
}
出现string' does not name a type。
需要将定义放在using namespace std 后。
#include <cstdlib>
#include <iostream>
#include <string>
string sa[10];
int ia[10];
using namespace std;
int main(int argc, char *argv[])
{
string sa2[10];
int ia2[10];
for (int i=0; i!=0
cout <<*sa<<endl;
system("PAUSE");
return EXIT_SUCCESS;
}
出现string' does not name a type。
需要将定义放在using namespace std 后。
相关文章推荐
- 异常:Property 'name' not found on type java.lang.String,attribute items does not accept any
- The type or namespace name 'Windows' does not exist in the class or namespace 'System'
- opencv2.0 源码安装 for x86 make出现error: 'ptrdiff_t' does not name a type 解决
- 两个C++编译错误及解决办法--does not name a type和field `XX' has incomplete type
- error: 'uint8_t' does not name a type
- ndk编译错误:error: 'override' does not name a type
- gem5编译错误:'ptrdiff_t' does not name a type 和 build/ALPHA/python/swig/stats_wrap.o
- javax.el.PropertyNotFoundException: Property 'name' not found on type java.lang.String
- 编译错误 --- does not name a type和field `XX' has incomplete type
- C++报错集合:XX does not name a type;field `XX' has incomplete type
- CS0234 The type or namespace name 'Mvc' does not exist in the namespace 'Microsoft.AspNet' (are you
- 编译错误 --- does not name a type和field `XX' has incomplete type
- 错误:A SPI class of type org.apache.lucene.*** with name 'Whitespace' does not exist.
- `QtValidLicenseForCoreModule' does not name a type 错误的解决
- 两个C++编译错误及解决办法--does not name a type和field `XX' has incomplete type
- 两个C++编译异常及解决方法-does not name a type和field `XX' has incomplete type
- NDK error: 'off_t' does not name a type
- 两个C++编译错误及解决办法--does not name a type和field `XX' has incomplete type
- 两个C++编译错误及解决办法--does not name a type和field `XX' has incomplete type
- Bean property 'esyerDao' is not writable or has an invalid setter method. Does the parameter type of