LNK1104 cannot open file nafxcwd.lib. Sample program - Programmer

This is a discussion on LNK1104 cannot open file nafxcwd.lib. Sample program - Programmer ; Hi Visual C/C++ experts. I downloaded some example code from the MS website. Unfortunately, it won't compile. I get a linker failure message: -fatal error LNK1104: cannot open file nafxcwd.lib. I read up in the Usenet and found that I ...

+ Reply to Thread
Results 1 to 4 of 4

Thread: LNK1104 cannot open file nafxcwd.lib. Sample program

  1. LNK1104 cannot open file nafxcwd.lib. Sample program


    Hi Visual C/C++ experts.

    I downloaded some example code from the MS website. Unfortunately,
    it won't compile. I get a linker failure message:
    -fatal error LNK1104: cannot open file nafxcwd.lib.

    I read up in the Usenet and found that I have to change my project to
    run with dynamically-linked DLLs. I also looked up in the MS KBase and
    found the article as to how to do this. The detail steps from
    http://article support.microsoft.com/kb/243458 is:
    __________________________________________________ ______________
    MORE INFORMATION
    To change your MFC project setting to link dynamically to the MFC
    libraries, perform the following steps: 1. Open your MFC project.
    2. From the Project menu, click Settings.
    3. In the Settings For combo box, select All Configurations.
    4. Click the General tab. If it is not visible, use the tab scroll
    buttons to scroll to the left.
    5. In the Microsoft Foundation Classes combo box, select Use MFC in a
    Shared DLL.
    6. Click OK to save the changes.
    __________________________________________________ ______________

    When I open up the Project Settings dialog for this downloaded example
    program, there are only two tabs- General and Debug. In that, there are
    four field settings under the General tab: Bulld Command Line, Rebuild
    All Options, Output file name, and Browse Info File Name.

    In a different project I have, the 'Microsoft Foundation Classes'
    option field is listed and changeable under the General tab.

    I am using XP, SP2.

    Thanks for your help,

    Feedscrn

    +--------------------------------------------+
    | The screen is hungry, Feed It! |
    +--------------------------------------------+


  2. Re: LNK1104 cannot open file nafxcwd.lib. Sample program


    Sorry that this is a basic question.. I know. But if someone can
    drop a hint.. that would be appreciated.


    Much Thanks,

    Feedscrn

    --------------------------------------------------------------------------------------------------------------------


    feedscrn wrote:
    > Hi Visual C/C++ experts.
    >
    > I downloaded some example code from the MS website. Unfortunately,
    > it won't compile. I get a linker failure message:
    > -fatal error LNK1104: cannot open file nafxcwd.lib.
    >
    > I read up in the Usenet and found that I have to change my project to
    > run with dynamically-linked DLLs. I also looked up in the MS KBase and
    > found the article as to how to do this. The detail steps from
    > http://article support.microsoft.com/kb/243458 is:
    > __________________________________________________ ______________
    > MORE INFORMATION
    > To change your MFC project setting to link dynamically to the MFC
    > libraries, perform the following steps: 1. Open your MFC project.
    > 2. From the Project menu, click Settings.
    > 3. In the Settings For combo box, select All Configurations.
    > 4. Click the General tab. If it is not visible, use the tab scroll
    > buttons to scroll to the left.
    > 5. In the Microsoft Foundation Classes combo box, select Use MFC in a
    > Shared DLL.
    > 6. Click OK to save the changes.
    > __________________________________________________ ______________
    >
    > When I open up the Project Settings dialog for this downloaded example
    > program, there are only two tabs- General and Debug. In that, there are
    > four field settings under the General tab: Bulld Command Line, Rebuild
    > All Options, Output file name, and Browse Info File Name.
    >
    > In a different project I have, the 'Microsoft Foundation Classes'
    > option field is listed and changeable under the General tab.
    >
    > I am using XP, SP2.
    >
    > Thanks for your help,
    >
    > Feedscrn
    >
    > +--------------------------------------------+
    > | The screen is hungry, Feed It! |
    > +--------------------------------------------+



  3. Re: LNK1104 cannot open file nafxcwd.lib. Sample program

    "feedscrn" wrote:
    >
    > Sorry that this is a basic question.. I know. But if someone can
    >drop a hint.. that would be appreciated.
    >...
    >
    >feedscrn wrote:
    >> Hi Visual C/C++ experts.
    >>
    >> I downloaded some example code from the MS website. Unfortunately,
    >> it won't compile. I get a linker failure message:
    >> -fatal error LNK1104: cannot open file nafxcwd.lib.


    You don't mention what version of the compiler are you using. If you are
    using the free version, Visual C++ 2005 Express Edition, then MFC and ATL
    are not included.
    --
    Tim Roberts, timr@probo.com
    Providenza & Boekelheide, Inc.

  4. Re: LNK1104 cannot open file nafxcwd.lib. Sample program


    Tim,

    Thanks for responding. I am using the Standard Edition version,
    with sp6.

    After much digging, I found that this problem can be difficult to
    resolve, as the same message can appear for different linkage
    scenarios.

    The code now compiles. Hallelujah! The steps I took to fix it are
    (I'm not sure which step or combination of steps were necessary. I
    already spent so much time on this):

    o Copied code from MFC Windows-based application, then changed it.
    Put in Main
    ..cpp file ::Create(xxxxxx) member function:
    --Orig from windows-based app:
    #ifdef _AFXDLL
    Enable3dControls();
    #else
    Enable3dControlsStatic();
    #endif
    --New version
    #ifdef _AFXDLL
    InitCommonControls();
    // Enable3dControls(); -- commented out.
    #else
    Enable3dControlsStatic();
    #endif

    o In Project | Settings C/C++ field | General catagory |
    Preprocessor
    Definitions, added:
    _AFXDLL
    to specify dynamically-linked .dll linkage (ties in
    with above step)

    o Put all these .lib files into the Project | Settings field:
    --In Project Settings | Link | General | Object/Library modules
    field:
    kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib
    advapi32.lib shell32.lib
    ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib
    --There are probably some that can be omitted when time permits.


    Take Care,
    God Bless,

    Feedscrn
    ------------------------------------------------------------------
    Tim Roberts wrote:
    > "feedscrn" wrote:
    > >
    > > Sorry that this is a basic question.. I know. But if someone can
    > >drop a hint.. that would be appreciated.
    > >...
    > >
    > >feedscrn wrote:
    > >> Hi Visual C/C++ experts.
    > >>
    > >> I downloaded some example code from the MS website. Unfortunately,
    > >> it won't compile. I get a linker failure message:
    > >> -fatal error LNK1104: cannot open file nafxcwd.lib.

    >
    > You don't mention what version of the compiler are you using. If you are
    > using the free version, Visual C++ 2005 Express Edition, then MFC and ATL
    > are not included.
    > --
    > Tim Roberts, timr@probo.com
    > Providenza & Boekelheide, Inc.



+ Reply to Thread