Announcement

Collapse
No announcement yet.

Solution: Linker error in VS.net

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Solution: Linker error in VS.net

    Hi

    I had a problem compiling under studio .net, when following the instructions.
    (Hopefully these tips will save someone else from wasting many hours like I did.)

    As per instructions, I created a fresh MFC-DLL project, deleted out the auto-generated stuff, and tried to follow the instructions given for older MS Studio version.

    However, I got the error:

    MyPlugin error LNK2005: [email protected] already defined in MSVCRTD.lib(dllmain.obj)
    Searching D:\Program Files\Microsoft Visual Studio .NET\Vc7\lib\kernel32.lib:
    Searching D:\Program Files\Microsoft Visual Studio .NET\Vc7\PlatformSDK\lib\user32.lib:

    and using the /link /VERBOSE:LIB linker directive, the linker output was:


    Searching libraries
    ...
    Searching D:\Program Files\Microsoft Visual Studio .NET\Vc7\lib\MSVCRTD.lib:
    ...
    Searching D:\Program Files\Microsoft Visual Studio .NET\Vc7\atlmfc\lib\mfcs70d.lib:
    mfcs70d.lib(dllmodul.obj) : error LNK2005: [email protected] already defined in MSVCRTD.lib(dllmain.obj)

    The solution was to change the setting

    Property Pages -> C/C++ -> Preprocessor -> Preprocessor Definitions

    and remove _USRDLL and add _AFXEXT.

    so now the line reads:

    WIN32;_WINDOWS;_DEBUG;_AFXEXT

    hope this helps someone.

    Cheers
    T.K.
Working...
X