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

  • 相关阅读:
    二、制作BOM表格--物料表格--Bill of Materials
    一、生成网络表--create Netlist
    Python使用OpenCV实现简单的人脸检测
    Spring编程式和声明式事务实例讲解
    可能是最漂亮的Spring事务管理详解
    关于Java IO与NIO知识都在这里
    Java IO,硬骨头也能变软
    Java NIO之拥抱Path和Files
    Java NIO之Selector(选择器)
    Java NIO 之 Channel(通道)
  • 原文地址:https://www.cnblogs.com/cutepig/p/1791250.html
Copyright © 2011-2022 走看看