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. CImage linker problems. Please help!

CImage linker problems. Please help!

Scheduled Pinned Locked Moved C / C++ / MFC
c++helpcsharplearning
4 Posts 3 Posters 0 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.
  • R Offline
    R Offline
    Rostfrei
    wrote on last edited by
    #1

    Hello! I have a simple application done with VC++ (2003 .NET). I made simple dialog based application with some buttons (with resource editor). Now I want to do something with images and want to try cool code with CImage class. By MSDN documentation I have to to include #include "afxstr.h" (I replaced <> with " so it can be seen in this post) #include "atlimage.h" in that exact order. Project setting is "Use MFC in shared DLL". When I do this I get many linker errors like LIBCMTD.lib(dbgheap.obj) : error LNK2005: _malloc already defined in msvcrtd.lib(MSVCR71D.dll) LIBCMTD.lib(dbgheap.obj) : error LNK2005: _calloc already defined in msvcrtd.lib(MSVCR71D.dll) LIBCMTD.lib(dbgheap.obj) : error LNK2005: _realloc already defined in msvcrtd.lib(MSVCR71D.dll) LIBCMTD.lib(dbgheap.obj) : error LNK2005: _free already defined in msvcrtd.lib(MSVCR71D.dll) LIBCMTD.lib(dosmap.obj) : error LNK2005: __errno already defined in msvcrtd.lib(MSVCR71D.dll) LIBCMTD.lib(crt0dat.obj) : error LNK2005: _exit already defined in msvcrtd.lib(MSVCR71D.dll) LIBCMTD.lib(crt0dat.obj) : error LNK2005: __exit already defined in msvcrtd.lib(MSVCR71D.dll) LIBCMTD.lib(crt0dat.obj) : error LNK2005: __cexit already defined in msvcrtd.lib(MSVCR71D.dll) LIBCMTD.lib(crt0dat.obj) : error LNK2005: __c_exit already defined in msvcrtd.lib(MSVCR71D.dll) LIBCMTD.lib(fflush.obj) : error LNK2005: _fflush already defined in msvcrtd.lib(MSVCR71D.dll) LIBCMTD.lib(isctype.obj) : error LNK2005: __isctype already defined in msvcrtd.lib(MSVCR71D.dll) LIBCMTD.lib(crt0.obj) : error LNK2005: __amsg_exit already defined in msvcrtd.lib(MSVCR71D.dll) LIBCMTD.lib(crt0init.obj) : error LNK2005: ___xc_z already defined in msvcrtd.lib(cinitexe.obj) LIBCMTD.lib(crt0init.obj) : error LNK2005: ___xc_a already defined in msvcrtd.lib(cinitexe.obj) LIBCMTD.lib(crt0init.obj) : error LNK2005: ___xi_z already defined in msvcrtd.lib(cinitexe.obj) LIBCMTD.lib(crt0init.obj) : error LNK2005: ___xi_a already defined in msvcrtd.lib(cinitexe.obj) LIBCMTD.lib(strftime.obj) : error LNK2005: _strftime already defined in msvcrtd.lib(MSVCR71D.dll) LIBCMTD.lib(winxfltr.obj) : error LNK2005: __XcptFilter already defined in msvcrtd.lib(MSVCR71D.dll) LIBCMTD.lib(atox.obj) : error LNK2005: _atoi already defined in msvcrtd.lib(MSVCR71D.dll) LIBCMTD.lib(getenv.obj) : error LNK2005: _getenv already defined in msvcrtd.lib(MSVCR71D.dll) zlib.lib(minigzip.obj) : error LNK2005: _error already defined in webServer.lib(uemf.obj) msvcrtd.lib(MSVCR71D.dll) : e

    C 1 Reply Last reply
    0
    • R Rostfrei

      Hello! I have a simple application done with VC++ (2003 .NET). I made simple dialog based application with some buttons (with resource editor). Now I want to do something with images and want to try cool code with CImage class. By MSDN documentation I have to to include #include "afxstr.h" (I replaced <> with " so it can be seen in this post) #include "atlimage.h" in that exact order. Project setting is "Use MFC in shared DLL". When I do this I get many linker errors like LIBCMTD.lib(dbgheap.obj) : error LNK2005: _malloc already defined in msvcrtd.lib(MSVCR71D.dll) LIBCMTD.lib(dbgheap.obj) : error LNK2005: _calloc already defined in msvcrtd.lib(MSVCR71D.dll) LIBCMTD.lib(dbgheap.obj) : error LNK2005: _realloc already defined in msvcrtd.lib(MSVCR71D.dll) LIBCMTD.lib(dbgheap.obj) : error LNK2005: _free already defined in msvcrtd.lib(MSVCR71D.dll) LIBCMTD.lib(dosmap.obj) : error LNK2005: __errno already defined in msvcrtd.lib(MSVCR71D.dll) LIBCMTD.lib(crt0dat.obj) : error LNK2005: _exit already defined in msvcrtd.lib(MSVCR71D.dll) LIBCMTD.lib(crt0dat.obj) : error LNK2005: __exit already defined in msvcrtd.lib(MSVCR71D.dll) LIBCMTD.lib(crt0dat.obj) : error LNK2005: __cexit already defined in msvcrtd.lib(MSVCR71D.dll) LIBCMTD.lib(crt0dat.obj) : error LNK2005: __c_exit already defined in msvcrtd.lib(MSVCR71D.dll) LIBCMTD.lib(fflush.obj) : error LNK2005: _fflush already defined in msvcrtd.lib(MSVCR71D.dll) LIBCMTD.lib(isctype.obj) : error LNK2005: __isctype already defined in msvcrtd.lib(MSVCR71D.dll) LIBCMTD.lib(crt0.obj) : error LNK2005: __amsg_exit already defined in msvcrtd.lib(MSVCR71D.dll) LIBCMTD.lib(crt0init.obj) : error LNK2005: ___xc_z already defined in msvcrtd.lib(cinitexe.obj) LIBCMTD.lib(crt0init.obj) : error LNK2005: ___xc_a already defined in msvcrtd.lib(cinitexe.obj) LIBCMTD.lib(crt0init.obj) : error LNK2005: ___xi_z already defined in msvcrtd.lib(cinitexe.obj) LIBCMTD.lib(crt0init.obj) : error LNK2005: ___xi_a already defined in msvcrtd.lib(cinitexe.obj) LIBCMTD.lib(strftime.obj) : error LNK2005: _strftime already defined in msvcrtd.lib(MSVCR71D.dll) LIBCMTD.lib(winxfltr.obj) : error LNK2005: __XcptFilter already defined in msvcrtd.lib(MSVCR71D.dll) LIBCMTD.lib(atox.obj) : error LNK2005: _atoi already defined in msvcrtd.lib(MSVCR71D.dll) LIBCMTD.lib(getenv.obj) : error LNK2005: _getenv already defined in msvcrtd.lib(MSVCR71D.dll) zlib.lib(minigzip.obj) : error LNK2005: _error already defined in webServer.lib(uemf.obj) msvcrtd.lib(MSVCR71D.dll) : e

      C Offline
      C Offline
      Chris Losinger
      wrote on last edited by
      #2

      all static libraries must use the same runtime libraries as your application. if you are using MFC in a DLL in your EXE, the .LIBs must all be built with the "multi-threaded DLL" setting; if you are using statically-linked MFC in your EXE, the .LIBs must all be built with the "multi-threaded" CRT. see the Code Generation option in the library's C/C++ Properties. Cleek | Image Toolkits | Thumbnail maker

      R 1 Reply Last reply
      0
      • C Chris Losinger

        all static libraries must use the same runtime libraries as your application. if you are using MFC in a DLL in your EXE, the .LIBs must all be built with the "multi-threaded DLL" setting; if you are using statically-linked MFC in your EXE, the .LIBs must all be built with the "multi-threaded" CRT. see the Code Generation option in the library's C/C++ Properties. Cleek | Image Toolkits | Thumbnail maker

        R Offline
        R Offline
        Rostfrei
        wrote on last edited by
        #3

        I made sure that all files are compiled with "Use MFC in a Shared DLL" option and they all have "Multi-threaded Debug DLL (/MDd)" runtime library selected and I still have linker errors. If I comment includes #include <afxstr.h> #include <atlimage.h> there is no link errors anymore. Any idea? Regards, Rostfrei

        G 1 Reply Last reply
        0
        • R Rostfrei

          I made sure that all files are compiled with "Use MFC in a Shared DLL" option and they all have "Multi-threaded Debug DLL (/MDd)" runtime library selected and I still have linker errors. If I comment includes #include <afxstr.h> #include <atlimage.h> there is no link errors anymore. Any idea? Regards, Rostfrei

          G Offline
          G Offline
          G Haranadh
          wrote on last edited by
          #4

          May be Try with giving complete path.. ex: "..\afxstr.h" Nice talking to you. :-O
          If you judge people, you have no time to love them. -- Mother Teresa

          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