Lnk 2005 error in release only

This is a discussion on Lnk 2005 error in release only within the Windows Programming forums, part of the Platform Specific Boards category; When building my dll in release mode using VS2005 I get this linker error for mfcs80u.lib: error LNK2005: _DllMain@12 already ...

  1. #1
    Registered User
    Join Date
    Feb 2009
    Posts
    2

    Lnk 2005 error in release only

    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)

    Strangely, it builds fine in debug mode.
    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 mfcs80u.lib listed first) but to no avail.
    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

  2. #2
    Registered User
    Join Date
    Feb 2009
    Posts
    2
    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.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. debug release conf problem
    By fighter92 in forum Game Programming
    Replies: 6
    Last Post: 03-20-2009, 05:39 PM
  2. assembly code for release code?
    By George2 in forum Windows Programming
    Replies: 4
    Last Post: 07-09-2008, 12:17 PM
  3. AddRef and Release
    By George2 in forum C++ Programming
    Replies: 20
    Last Post: 02-07-2008, 01:19 AM
  4. If you must port to .NET 2005, read this thread.
    By VirtualAce in forum A Brief History of Cprogramming.com
    Replies: 3
    Last Post: 10-22-2007, 07:51 AM
  5. Arghhhh! LNK 2005 error.
    By cunnus88 in forum C++ Programming
    Replies: 3
    Last Post: 05-12-2006, 10:24 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21