#include <vector>
using std::vector;
struct pt
{
    double x;
    double y;
};
typedef vector<pt> ptArray;
struct LinXY
{
    char name[256];
    char BianHao[256];
    ptArray arrayXY;
};
typedef vector<LinXY> LinXYArray;我将上面代码加入到
class CFieldGather 
{
}类的头文件中,总是编译出错
:\program files\microsoft visual studio\vc98\include\new(35) : error C2061: syntax error : identifier 'THIS_FILE'
c:\program files\microsoft visual studio\vc98\include\new(35) : error C2091: function returns function
c:\program files\microsoft visual studio\vc98\include\new(35) : error C2809: 'operator new' has no formal parameters
c:\program files\microsoft visual studio\vc98\include\new(36) : error C2061: syntax error : identifier 'THIS_FILE'
c:\program files\microsoft visual studio\vc98\include\new(37) : error C2091: function returns function
c:\program files\microsoft visual studio\vc98\include\new(37) : error C2556: 'void *(__cdecl *__cdecl operator new(void))(unsigned int,const struct std::nothrow_t &)' : overloaded function differs only by return type from 'void *(__cdecl *__cdecl op
erator new(void))(unsigned int)'不知道是我工程什么代码影响了它,因为我重新建一个工程,加入就没有问题

解决方案 »

  1.   

    #include <vector>
    using std::vector;
    struct pt
    {
    double x;
    double y;
    };
    typedef vector<struct pt> ptArray; // vector<pt> 改为 vector<struct pt> ???
    struct LinXY 
    {
    char name[256];
    char BianHao[256];
    ptArray arrayXY;
    };
      

  2.   

    typedef vector<LinXY> LinXYArray; 
    // 改为
    typedef vector<struct LinXY> LinXYArray; 
      

  3.   

    这种现象我遇到过,当时让我焦头烂额。其实原因也简单,就是因为你没有注明名空间,在小的工程里面编译器会为你纠正这个小错误,但随着工程的增大,编译器不再有能力为你纠错。所以我们要相信开发环境,但也不能过分相信和依赖它。
    如下就OK:
    #include <vector>
    using std::vector;
      

  4.   

    我看了一下我原来的工程是这样定义的:
    #include <vector>
    using namespace std;
      

  5.   

    检查你的Class定义是否少了分号。