Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
这里说您可以在 MFC 应用程序中将 DEBUG_NEW 代替 new。当我这样做时,编译器会说 DEBUG_NEW 没有定义。它是 VS 2017。定义了 _DEBUG。有什么问题?
[编辑] 首先我应该注意我把它作为整个项目的全局定义。有成千上万的错误(这是一个大项目)。然后我只改变了一次。一个在我的代码中。它不工作。包含但不直接
你需要更具体。你把它放在哪里?
在新生成的 MFC 应用程序中,他们通常将这些行放在包含后的 .cpp 文件中(参见最后 3 行):
// LangInfo.cpp : Defines the class behaviors for the application. // #include "stdafx.h" #include "LangInfo.h" #include "LangInfoDlg.h" #ifdef _DEBUG #define new DEBUG_NEW #endif