今天遇到了一个奇怪的事情如下:
#include "stdafx.h"
#include "ImageDsp.h"
#include "ImageDsp1.h"
#include "ximage.h"              //CxImage类头文件
#include "FindBCharacter.h"      //识别模块头文件
#include "FindChar.h"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif

#include "FindBCharacter.h"      //识别模块头文件
#include "FindChar.h"

红色字体中的头文件放到兰色位置时,就出现了c:\stl\stlport\new(36) : fatal error C1083: Cannot open include file: '../include/new(THIS_FILE, 36)': Invalid argument
这个错误,不知道为什么,请高手指教下,头文件包含顺序方面的问题
另外,下面这些是什么意思,谢谢.
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif

解决方案 »

  1.   

    利用宏定义覆盖 new ,使debug版本下可以获得内存泄漏的信息
      

  2.   

    感觉头文件放在这两个位置已经基本上是一样的。
    这段代码是条件编译,作用如1楼所说。
    建议LZ再试试,另外如果用Release编译,这两个位置就完全一样了。
      

  3.   

    照理说,在头文件中不应该有new来分配内存的,你可能有这种不合常规的做法。
      

  4.   

    #include <new>标准new头文件丢失?实在不行, 就把这面这堆代码删掉.
    #ifdef _DEBUG
    #undef THIS_FILE
    static char THIS_FILE[]=__FILE__;
    #define new DEBUG_NEW
    #endif 
      

  5.   

    谢谢各位,我明白了,这个是在release下,没错,另外加上#include <new>也没错,呵呵