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

  • 相关阅读:
    学习Vue.js
    Xmind思维导图
    Webpack 入门教程
    Vscode 使用介绍
    jdk,jre下载安装
    Java JDK下载
    FileZilla FTP下载
    notepad++下载
    windows环境搭建Vue开发环境
    SecureCRTPortable的安装和使用(图文详解)
  • 原文地址:https://www.cnblogs.com/cutepig/p/1791250.html
Copyright © 2011-2022 走看看