none
Error LNK2005 RRS feed

  • Question

  • When building my dll in release mode using VS2005 I get this linker error for mfcs80u.lib:
     
    error LNK2005: _DllMain@12 already defined in msvcrt.lib(dllmain.obj

        
    I've googled it and found this: http://support.microsoft.com/kb/148652
    As described, I tried ignoring the two libraries (msvcrt.lib and mfcs80u.lib) and adding them as dependencies (with the mfc lib listed first). I've also tried including Afx.h in each file and I wasn't using precomplied headers so I'm a bit stuck.
    My dll is setup as using MFC in a shared dll and the runtime library is Multi-threaded dll.

    Has anyone any ideas how I can solve this?

    Harry

    Tuesday, February 10, 2009 3:00 PM

Answers

  • I have solved this. My project was not originally setup as an MFC project so I can only presume that the preprocessor settings were not correct. I created a new project using the MFC DLL template, added all the necessary files and it built without problem in release mode.
    • Proposed as answer by ildjarn Wednesday, February 11, 2009 6:40 PM
    • Marked as answer by Nancy Shao Monday, February 16, 2009 1:22 AM
    Wednesday, February 11, 2009 3:40 PM

All replies

  • I have solved this. My project was not originally setup as an MFC project so I can only presume that the preprocessor settings were not correct. I created a new project using the MFC DLL template, added all the necessary files and it built without problem in release mode.
    • Proposed as answer by ildjarn Wednesday, February 11, 2009 6:40 PM
    • Marked as answer by Nancy Shao Monday, February 16, 2009 1:22 AM
    Wednesday, February 11, 2009 3:40 PM
  • goto project settings and in linker option -> command line give the following option then compile

    /FORCE:MULTIPLE

    this will solve your issue.
    Wednesday, February 11, 2009 7:37 PM