我建立了一个 console 支持 MFC的应用
在主文件里
#include "string.h"struct sms{
string tel_num;
string msg;
};
就能BUILD但在新加的类的头文件里 就有错
error C2146: syntax error : missing ';' before identifier 'tel_num'在string上右键 goto定义 有时找到在XSTRING里 有时在XLOCNUM里由于这个string,后面调用sms tel_num msg 的地方产生了上百个错误,烦死我啦!
到处加 
#include "string.h"
#include <string>
都没用

解决方案 »

  1.   

    struct sms{
     CString tel_num;
     CString msg;
    };
      

  2.   

    string指STL的串模本类吗,如是,#include <string>
      

  3.   

    就是c++的string,是什么模板我不知道我要进行 tel_num[i]这样的操作
    CString可以吗?如果用char*的话 怕不安全,tel_num[i]可能会超出范围
    或者,怎么给 char*分配连续的200byte 空间?
      

  4.   

    #Include <string>
    using namespace std