CImg Konstruktor Problem



  • Hallo,
    soeben wollte ich die CImg.h in mein MFC Projekt includen, bin jedoch erfolglos beim erstellen eines Objektes.

    #include "CImg.h"
    using namespace cimg_library;
    

    dies funktioniert fehlerfrei, doch sobald ich

    CImg<unsigned char> test("beispiel.jpg");
    

    benutze wirft mir VS2013 folgende Fehler:

    Fehler	1	error LNK2005: "void * __cdecl operator new[](unsigned int)" (??_U@YAPAXI@Z) ist bereits in libcpmtd.lib(newaop.obj) definiert.	C:\Users\---\Documents\Visual Studio 2013\Projects\---\Projectname\MFCApplication1\uafxcwd.lib(afxmem.obj)
    
    Fehler	2	error LNK1169: Mindestens ein mehrfach definiertes Symbol gefunden.	C:\Users\---\Documents\Visual Studio 2013\Projects\---\Projectname\Debug\MFCApplication1.exe	1
    

    Google hat mir leider keine Antwort geliefert. Zur Not werde ich auf eine andere Bibiothek zurückgreifen.

    MfG



  • Das hat vermutlich nix mit CImg zu tun.
    Google mal nach LNK2005 uafxcwd.lib



  • Das hier:

    The CRT libraries use weak external linkage for the new, delete, and DllMain functions. The MFC libraries also contain new, delete, and DllMain functions. These functions require the MFC libraries to be linked before the CRT library is linked. http://support.microsoft.com/kb/148652

    Solution based on VS2005

    go to project>properties>configuration properties>linker>input

    add to "Additional dependency" -> Nafxcwd.lib Libcmtd.lib

    add to "ignore specific library" -> Nafxcwd.lib;Libcmtd.lib

    order of libraries is important( Nafxcwd.lib;Libcmtd.lib).

    funktioniert iwie auch nicht, da wirft er mir den error dass er die datei Nafxcwd.lib Libcmtd.lib nicht findet.

    Fehler	1	error LNK1104: Datei "Nafxcwd.lib Libcmtd.lib" kann nicht geöffnet werden.	C:\Users\---\documents\visual studio 2013\Projects\---\Projectname\MFCApplication1\LINK
    


  • add to "Additional dependency" -> Nafxcwd.lib Libcmtd.lib
    add to "Additional dependency" -> Nafxcwd.lib;Libcmtd.lib

    Hättest du jetzt aber auch selbst draufkommen können.

    ps: Die bessere Lösung wäre "Solution Two: Locate and Correct the Problem Module".
    Ignore Library ist immer ein Hack.



  • das habe ich natürlich auch probiert, jedoch kommt die die gleiche fehlermeldung mit nur dem ersten dateinamen

    Fehler	1	error LNK1104: Datei "Nafxcwd.lib" kann nicht geöffnet werden.	C:\Users\Andy\documents\visual studio 2013\Projects\Bachelor\GraphenProgramm 2.0\MFCApplication1\LINK
    

    naja, ich schau morgen mal ob ich eine alternative zu CImg finde



  • Weil die Library bei dir uafxcwd.lib heisst und nicht nafxcwd.lib.

    => Ersetze nafxcwd.lib in dem Beispiel durch uafxcwd.lib.

    Wobei ich nochmal auf

    hustbaer schrieb:

    ps: Die bessere Lösung wäre "Solution Two: Locate and Correct the Problem Module".
    Ignore Library ist immer ein Hack.

    hinweisen möchte.


Anmelden zum Antworten