需要声明一个结构体,作为全局变量使用,书上说应该放到stdafx.h中,作如下声明:
    struct STUDENT
     {
         String strName;
         String strID;
         int     nScore[3];
         double  dAve;
     };
用VC6.0编译,总出错,就是因为CString不认为是类型,认为是变量,怎样解决?而且,compile时,总提示:cannot compile the file 'h:\vc++\ex\StdAfx.h';no compile tools is associated with the file etension.
但是可以BUILD,然后就是出错

解决方案 »

  1.   

    在stdafx.h中作如下两种声明都应该是可以的
    1.  struct STUDENT
         {
             CString strName;
             CString strID;
             int     nScore[3];
             double  dAve;
         };
    2.  #include <string>
        struct STUDENT
         {
            std::string strName;
            std::string strID;
            int     nScore[3];
            double  dAve;
         };