1. Dashboard
  2. Forum
    1. Unerledigte Themen
  3. Mitglieder
    1. Letzte Aktivitäten
    2. Benutzer online
    3. Team-Mitglieder
    4. Trophäen
    5. Mitgliedersuche
  4. Tutorial Bereich
  • Anmelden
  • Registrieren
  • Suche
Dieses Thema
  • Alles
  • Dieses Thema
  • Dieses Forum
  • Seiten
  • Forum
  • Lexikon
  • Erweiterte Suche
  1. Informatik Forum
  2. Webmaster & Internet
  3. Entwicklung

C++ eclipse mingw external library problem

  • Dadar
  • 9. April 2012 um 19:22
  • Unerledigt
  • Dadar
    2
    Dadar
    Mitglied
    Punkte
    15
    Beiträge
    2
    • 9. April 2012 um 19:22
    • #1

    I am trying to include an image library to eclipse... but just get following error message:
    g++ -LC:\MinGW -LC:\librariesC\CImg149 -oCImgSd.exe CImgSd.o -lCImg
    c:/mingw/bin/../lib/gcc/mingw32/4.6.1/../../../../mingw32/bin/ld.exe: cannot find -lCImg

    I already added the library search paths, where the 1. MinGw and 2. CImg files are, in Project properties - C/C++Build - Settings

    First in GCC C++ Compiler - includes
    second in GCC C Compiler - includes
    third in MinGW C++ Linker - libraries

    Furthermore I added the name of of the lib file 'CImg' to the second and third.

    The file it should find is 'CImg.h' and it is placed in the C:\MinGW -LC:\librariesC\CImg149 folder.

    I am using windows7 and added C:\MinGW\bin to the path variable

    Or is it maybe a mingw problem, someone knows a better C++ Compiler, which I can use easily with an image processing library?

    Someone knows what's wrong, because I'm googling for three days right now and tried many things but nothing worked out...

  • gelbasack
    25
    gelbasack
    Mitglied
    Reaktionen
    90
    Punkte
    6.525
    Beiträge
    1.241
    • 9. April 2012 um 19:58
    • #2

    You do not need the file 'CImg.h' at that build step. Header files are only necessary for compiling the code, you're already linking your compiled code when this error occurs.
    You need to specify the library file, i.e. something like CImg.lib most probably. I don't have a setup using Windows7/MinGW at the moment, but iirc you have to specify the library file including the extension, e.g. "CImg.lib" within the project configuration. Make sure the library path points to the directory including that file, not the .h file.

  • Dadar
    2
    Dadar
    Mitglied
    Punkte
    15
    Beiträge
    2
    • 9. April 2012 um 21:07
    • #3

    Thanks for the quick answer, but there's no .lib file in the cimg.zip i downloaded. Do I have do process the original files before I can use them as library?

  • gelbasack
    25
    gelbasack
    Mitglied
    Reaktionen
    90
    Punkte
    6.525
    Beiträge
    1.241
    • 9. April 2012 um 21:42
    • #4

    Probably you have downloaded the library's source code only.
    In general, you have several options (I don't know your specific library but that should do it in most cases):
    * create a new Eclipse CDT project using the source code from the library and build a lib file, use that lib file for linking
    * create the lib project and link the source folder as additional source folder to your project, i.e. your project includes the complete source code of the library then
    * libs could contain build scripts, makefiles,... for building outside of an IDE
    If you do not wish to change the source code contained in the library, I'd choose a way to compile the library to a .lib file and then use that lib file for linking. Otherwise, CDT is working fine if you just link (on file system level using Eclipse, not linking object files) the source folders into your project.

  • Maximilian Rupp 27. Dezember 2024 um 00:26

    Hat das Thema aus dem Forum Programmieren nach Entwicklung verschoben.

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!

Benutzerkonto erstellen Anmelden

Benutzer online in diesem Thema

  • 1 Besucher

Rechtliches

Impressum

Datenschutzerklärung