zoukankan      html  css  js  c++  java
  • 在一个另一个文件中 #include一个**dlg.h文件,会发生dlg的资源ID未定义的错误 :

    1    在一个另一个文件中 #include一个**dlg.h文件,会发生dlg的资源ID未定义的错误 :

    dlg1.h(23) : error C2065: 'IDD_DIALOG1' : undeclared identifier

    最简单的方法是在dlg的.h文件头加入    : #include "resource.h"

    2    debug assertion failed!

    “ASSERT()或VERIFY()语句:这两个宏是用来测试它的参数是否为真的。出现错误这说明你的指针或表达试有问题 。
    出错原因肯定就在ASSERT()或VERIFY()语句上,可能空指针、内存泄漏,条件不足、野指针和数组写越界.等等 ”

    野指针是指同一个内存区域被释放了两次..

    数组写越界就是对超出数组下界的区域进行写数据.
    我的错误是 野指针,注释了这行就搞定了 ://delete lpParameter;

    在MSDN上:

    Evaluates its argument.
    ASSERT(   booleanExpression)


    Parameters
    booleanExpression
    Specifies an expression (including pointer values) that evaluates to nonzero or 0.


    Remarks
    If the result is 0, the macro prints a diagnostic message and aborts the program. If the condition is nonzero, it does nothing.


    The diagnostic message has the form
    assertion failed in file <name> in line <num>
    where name is the name of the source file, and num is the line number of the assertion that failed in the source file.
    In the Release version of MFC, ASSERT does not evaluate the expression and thus will not interrupt the program. If the expression must be evaluated regardless of environment, use the VERIFY macro in place of ASSERT.


    Note   This function is available only in the Debug version of MFC.
    In an MFC ISAPI application, an assertion in debug mode will bring up a modal dialog box (ASSERT dialog boxes are now modal by default); this will interrupt or hang the execution. To suppress modal assertion dialogs, add the following lines to your project source file (projectname.cpp):
    // For custom assert and trace handling with WebDbg
    #ifdef _DEBUG
    CDebugReportHook g_ReportHook;
    #endif
    Once you have done this, you can use the WebDbg tool (WebDbg.exe) to see the assertions. For information on using the WebDbg tool, see Viewing Trace Messages And Handling Asserts.


    Example
    // example for ASSERT
    CAge* pcage = new CAge( 21 ); // CAge is derived from CObject.
    ASSERT( pcage!= NULL )
    ASSERT( pcage->IsKindOf( RUNTIME_CLASS( CAge ) ) )
    // Terminates program only if pcage is NOT a CAge*.

    3 warning C4312 : conversion from 'LONG' to 'WNDPROC' of greater size

    据说,这是因为32位/64位的问题,编译器是警告你代码到64位环境下可能会出问题。

    类型转换不要用(LONG_PTR),LongToPtr(),也不要直接用(WNPROC),而是用(WNDPROC)LongToPtr()。

    warning C4311: 'type cast' : pointer truncation from 'LRESULT (__stdcall *)(HWND,UINT,WPARAM,LPARAM)' to 'LONG'

  • 相关阅读:
    Python--day43--mysql自增列之起始值和步长
    Python--day43--补充之主键和外键
    Python--day42--MySQL外键定义及创建
    Python--day42--mysql操作数据库及数据表和基本增删改查
    Python--day42--mysql创建用户及授权
    sql数据库基础
    Python--day41--线程池--python标准模块concurrent.futures
    C# 第三方DLL,可以实现PDF转图片,支持32位系统、64位系统
    ASP.NET 使用Session,避免用户F5刷新时重复提交(转)
    (重要,部署和发布)c# webApi 服务端和客户端 详细实例
  • 原文地址:https://www.cnblogs.com/gredswsh/p/dlg_h_file_dlg_occur.html
Copyright © 2011-2022 走看看