zoukankan      html  css  js  c++  java
  • MFC Link problem

    nafxcw.lib    for MFC Static  Link Library

    Use of MFC in a Shared  DLL : _AFXDLL  in "preprocessor definitions" list defined

    When Using both CRT and MFC libraries together you need to be careful. In such cases its important for MFC libraries to get linked before CRT libraries.

    If you are using MFC, you need to link libc.lib before msvcrt.lib. You can do this by explicitely setting linker option.

    please go through this link... http://support.microsoft.com/kb/148652
    problem while linking CRT and MFC together

    Great!!! Thanks alot sach!!

    The solution I used was as per the link and creating a new header file, ForceLib.h. The file looks like this:
    Code:
    #ifndef _AFX_NOFORCE_LIBS

    /////////////////////////////////////////////////////////////////////////////
    // Win32 libraries

    #ifndef _AFXDLL
        #ifndef _UNICODE
            #ifdef _DEBUG
                #pragma comment(lib, "nafxcwd.lib")
            #else
                #pragma comment(lib, "nafxcw.lib")
            #endif
        #else
            #ifdef _DEBUG
                #pragma comment(lib, "uafxcwd.lib")
            #else
                #pragma comment(lib, "uafxcw.lib")
            #endif
        #endif
    #else
        #ifndef _UNICODE
            #ifdef _DEBUG
                #pragma comment(lib, "mfc71d.lib")
                #pragma comment(lib, "mfcs71d.lib")
            #else
                #pragma comment(lib, "mfc71.lib")
                #pragma comment(lib, "mfcs71.lib")
            #endif
        #else
            #ifdef _DEBUG
                #pragma comment(lib, "mfc71ud.lib")
                #pragma comment(lib, "mfcs71ud.lib")
            #else
                #pragma comment(lib, "mfc71u.lib")
                #pragma comment(lib, "mfcs71u.lib")
            #endif
        #endif
    #endif

    #ifdef _DLL
        #if !defined(_AFX_NO_DEBUG_CRT) && defined(_DEBUG)
            #pragma comment(lib, "msvcrtd.lib")
        #else
            #pragma comment(lib, "msvcrt.lib")
        #endif
    #else
    #ifdef _MT
        #if !defined(_AFX_NO_DEBUG_CRT) && defined(_DEBUG)
            #pragma comment(lib, "libcmtd.lib")
        #else
            #pragma comment(lib, "libcmt.lib")
        #endif
    #else
        #if !defined(_AFX_NO_DEBUG_CRT) && defined(_DEBUG)
            #pragma comment(lib, "libcd.lib")
        #else
            #pragma comment(lib, "libc.lib")
        #endif
    #endif
    #endif

    #pragma comment(lib, "kernel32.lib")
    #pragma comment(lib, "user32.lib")
    #pragma comment(lib, "gdi32.lib")
    #pragma comment(lib, "msimg32.lib")
    #pragma comment(lib, "comdlg32.lib")
    #pragma comment(lib, "winspool.lib")
    #pragma comment(lib, "advapi32.lib")
    #pragma comment(lib, "shell32.lib")
    #pragma comment(lib, "comctl32.lib")
    #pragma comment(lib, "shlwapi.lib")

    // force inclusion of NOLIB.OBJ for /disallowlib directives
    #pragma comment(linker, "/include:__afxForceEXCLUDE")

    // force inclusion of DLLMODUL.OBJ for _USRDLL
    #ifdef _USRDLL
    #pragma comment(linker, "/include:__afxForceUSRDLL")
    #endif

    // force inclusion of STDAFX.OBJ for precompiled types
    #ifdef _AFXDLL
    #pragma comment(linker, "/include:__afxForceSTDAFX")
    #endif

    #endif //!_AFX_NOFORCE_LIBS

  • 相关阅读:
    关于IDEA2019.3在书写pom依赖坐标无法自动提示补全的问题
    vue props的接收格式
    axios请求添加请求头 标准写法
    VUE后台管理系统建立
    arguments
    表单验证规则
    <<>> html内显示
    vue_UI组件库vant之加载转圈
    vue_axios请求拦截器
    vue_js数字有效长度16位_超出的解决办法
  • 原文地址:https://www.cnblogs.com/cutepig/p/1791250.html
Copyright © 2011-2022 走看看