Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Adding MFC to a non-MFC project

Adding MFC to a non-MFC project

Scheduled Pinned Locked Moved C / C++ / MFC
helpc++ai-codingdebuggingtutorial
3 Posts 3 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    Dave_
    wrote on last edited by
    #1

    As an example, there is a project posted here on codeproject (by John Roark) that displays a "skinned" dialog (sorry I don't have the link at this time). If I try to add a CStatic derived class to it, I keep getting link errors (see below). I am using the "Use MFC in a static library" option. Using a shared dll option does not produce the error, but I need to have the static library option. Every search I do keeps telling me that I can solve this error by selecting one of the Multi-Threaded options in the "Code Generation" tab of VC6. The thing is - I already have the Multi-Threaded option picked.:mad: I'm really hoping that this is a very simple problem to solve, but I'm stumped. Any ideas? Thanks, David Link errors: nafxcwd.lib(afxmem.obj) : error LNK2005: "void * __cdecl operator new(unsigned int)" (??2@YAPAXI@Z) already defined in LIBCMTD.lib(new.obj) nafxcwd.lib(afxmem.obj) : error LNK2005: "void __cdecl operator delete(void *)" (??3@YAXPAX@Z) already defined in LIBCMTD.lib(dbgdel.obj) Debug/SkinTrial.exe : fatal error LNK1169: one or more multiply defined symbols found Error executing link.exe.

    N B 2 Replies Last reply
    0
    • D Dave_

      As an example, there is a project posted here on codeproject (by John Roark) that displays a "skinned" dialog (sorry I don't have the link at this time). If I try to add a CStatic derived class to it, I keep getting link errors (see below). I am using the "Use MFC in a static library" option. Using a shared dll option does not produce the error, but I need to have the static library option. Every search I do keeps telling me that I can solve this error by selecting one of the Multi-Threaded options in the "Code Generation" tab of VC6. The thing is - I already have the Multi-Threaded option picked.:mad: I'm really hoping that this is a very simple problem to solve, but I'm stumped. Any ideas? Thanks, David Link errors: nafxcwd.lib(afxmem.obj) : error LNK2005: "void * __cdecl operator new(unsigned int)" (??2@YAPAXI@Z) already defined in LIBCMTD.lib(new.obj) nafxcwd.lib(afxmem.obj) : error LNK2005: "void __cdecl operator delete(void *)" (??3@YAXPAX@Z) already defined in LIBCMTD.lib(dbgdel.obj) Debug/SkinTrial.exe : fatal error LNK1169: one or more multiply defined symbols found Error executing link.exe.

      N Offline
      N Offline
      Navin
      wrote on last edited by
      #2

      Are you linking to any other static libraries? They will also need the same settings. One other thing - sometimes it is easer not to fight these types of errors and create a clean project from scratch. In other words, create a new project (DSP), making sure to select that you are using MFC statically. Then add your files, making sure things still compile. Chances are this will work, or at least help you narrow down the culprit. Even a broken clock is right twice a day.

      1 Reply Last reply
      0
      • D Dave_

        As an example, there is a project posted here on codeproject (by John Roark) that displays a "skinned" dialog (sorry I don't have the link at this time). If I try to add a CStatic derived class to it, I keep getting link errors (see below). I am using the "Use MFC in a static library" option. Using a shared dll option does not produce the error, but I need to have the static library option. Every search I do keeps telling me that I can solve this error by selecting one of the Multi-Threaded options in the "Code Generation" tab of VC6. The thing is - I already have the Multi-Threaded option picked.:mad: I'm really hoping that this is a very simple problem to solve, but I'm stumped. Any ideas? Thanks, David Link errors: nafxcwd.lib(afxmem.obj) : error LNK2005: "void * __cdecl operator new(unsigned int)" (??2@YAPAXI@Z) already defined in LIBCMTD.lib(new.obj) nafxcwd.lib(afxmem.obj) : error LNK2005: "void __cdecl operator delete(void *)" (??3@YAXPAX@Z) already defined in LIBCMTD.lib(dbgdel.obj) Debug/SkinTrial.exe : fatal error LNK1169: one or more multiply defined symbols found Error executing link.exe.

        B Offline
        B Offline
        Bill Wilson
        wrote on last edited by
        #3

        You probably need to do some more. There is an article in MSDN that describes what you have to do to add MFC support to an ATL project. It is pretty generalizable advice. Search for "Howto MFC ATL" to find the article.

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups