ATL LNK2005 in VC++ Express

Is there anything special I need to do to have ATL working I have it as an include and have an stdafx.h include.

I have compiled, linked and run this same code as one long source program but trying to modularize I get the LNK2005 for each routine other than the _tmain.

angsepn.obj : error LNK2005: _AtlIPersistStreamInit_Save@20 already defined in _tmain.obj

angsepn.obj : error LNK2005: _AtlIPersistPropertyBag_Save@24 already defined in _tmain.obj

angsepn.obj : error LNK2005: _AtlGetObjectSourceInterface@20 already defined in _tmain.obj

These look like ATL code but I'm so new to Windows programming, I'm lost.

Thanks for your help.

RON C




Answer this question

ATL LNK2005 in VC++ Express

  • Ron Dombrowski

    The Express Edition doesn't included the needed ATL/MFC libs. You have to use a larger edition for that.

    Thanks,
    Ayman Shoukry
    VC++ Team


  • Allan_Hansen

    There is not ATL/MFC 80 libraries available for download. You may download ATL/MFC 4.2 with Platform SDK, but these are only meant for porting 32bit applications built with VC6 to 64bit. They are not going to work with VC8 libraries.

    Nikola



  • KMahon

    I've added the ATL/MFC libraries from a download via the MSDN web site. They work fine for the all-in-one code but not the separated modules.

    RON C



  • 2232

    What version of ATL/MFC is this one After you #include "stdafx.", have you also specified that you are using pre-compiled header in this project



  • Jens Egil Evensen

    Nikola,

    I have compiled and executed the code using VC++ 2005 Express and the ATL/MFC libraries. The code I'm working with is older code from a Unix setup so maybe that's why it works.

    I have a need to separate the 100 or so functions into individual or groups. This is what I've done. I have included STDAFX.H in each module via an #include file. This is where I'm having the problem of duplicate references (

    error LNK2005: _AtlIPersistStreamInit_Load@16 already defined in _tmain.obj).

    Can you suggest what to do to get this fixed and done Hopefully the new code that I develop won't need ATL/MFC. I use OpenGL so I'll probably need them. Correct

    Thanks for you help and patience.

    RON C



  • ATL LNK2005 in VC++ Express