这是我在VC上运行的控制台程序,如何调用这个string?
#include <iostream.h>
#include <string.h>
#include <stdio.h>
void main()
{
string num;
}
--------------------Configuration: test1 - Win32 Debug--------------------
Compiling...
test1.cpp
E:\PROGRAMS\test1\test1.cpp(6) : error C2065: 'string' : undeclared identifier
E:\PROGRAMS\test1\test1.cpp(6) : error C2146: syntax error : missing ';' before identifier 'num'
E:\PROGRAMS\test1\test1.cpp(6) : error C2065: 'num' : undeclared identifier
Error executing cl.exe.test1.exe - 3 error(s), 0 warning(s)
#include <iostream.h>
#include <string.h>
#include <stdio.h>
void main()
{
string num;
}
--------------------Configuration: test1 - Win32 Debug--------------------
Compiling...
test1.cpp
E:\PROGRAMS\test1\test1.cpp(6) : error C2065: 'string' : undeclared identifier
E:\PROGRAMS\test1\test1.cpp(6) : error C2146: syntax error : missing ';' before identifier 'num'
E:\PROGRAMS\test1\test1.cpp(6) : error C2065: 'num' : undeclared identifier
Error executing cl.exe.test1.exe - 3 error(s), 0 warning(s)
解决方案 »
- 请问怎么做一个响应快捷键的函数
- 看到的一份不错的介绍“堆和栈的区别”的资料
- 关于24位bmp图像存储的一个初级问题
- MFC socket 传送 结构体,接收端出现乱七八糟的字符。
- 如何用钩子钩到QQ登录界面上的复选框
- 自定义表格控件的显示问题及属性设置?
- 如何响应水平、垂直滚动条右下角交叉处小方块的点击消息
- 大家都来关心一下COM的接口问题,我发现很多人问,都没有答案:定义的接口为VARIANT数组,在VBS里可以调用,在JSP里不能调用,为什么?
- 为何ListCtrl的第二列不显示?
- 如何在住doc中显示我的一个对话框中的变量
- 在vc中写MFC控件,在ondraw函数中如何获得当前dc是打印设备的dc,也就是说如何知道控件要打印了。
- 两种“向上强制转型”的结果会不一样,为什么?
typedef basic_string<char> string;
#include <iostream> //没有.h
#include <string> //没有.husing namespace std;main()
{
...
}
你的方法我试了,不行
看看c++primer吧 楼主or看看Essentialc++