0

I am trying to use the CImg.h library in Eclipse.

I have tried to use MinGW C++ Linker -- Library Search Path -- and set it to "C:\CImg\CImg-1.7.5".

However, my line #include <CImg.h> gives me a fatal error "CImg.h no such file or directory".

I get this error message in the Console:

Info: Internal Builder is used for build g++ -O0 -g3 -Wall -c -fmessage-length=0 -o "src\TileMap.o" "..\src\TileMap.cpp" ..\src\TileMap.cpp:74:18: fatal error: CImg.h: No such file or directory #include ^ compilation terminated.

drescherjm
  • 10,365
  • 5
  • 44
  • 64
Aaron Kreider
  • 1,705
  • 5
  • 22
  • 44
  • Take a look at this: https://codeyarns.com/2013/09/22/how-to-add-library-in-eclipse-cdt/ – Arnav Borborah Aug 31 '16 at 21:12
  • I'm trying to figure out how the libraries are included. My understanding is that CImg.h works as a stand alone library. Am I wrong? I'm using Windows 8.1. – Aaron Kreider Aug 31 '16 at 21:25
  • I'm using the solution in the duplicate question (I have added the link to C:\CImg\CImg-1.7.5\ in the MinGW C++ Linker settings) and it does not work. Do I need to link to any files besides CImg.h? – Aaron Kreider Aug 31 '16 at 21:37
  • 1
    ***fatal error: CImg.h: No such file or directory*** Is not a linker error. You need to setup your include path. – drescherjm Aug 31 '16 at 21:39
  • ***Do I need to link to any files besides CImg.h*** Header files are not linked. However there should be a library to link. – drescherjm Aug 31 '16 at 21:39
  • Ok I needed it in the include path. I'm very new to C++. So I don't understand the difference between header files and libraries (and I thought I read that CImg.h was both a header file and a library). – Aaron Kreider Aug 31 '16 at 21:44
  • ***I thought I read that CImg.h was both a header file and a library*** It is not. A good c++ book should explain a lot of this in the early chapters. – drescherjm Aug 31 '16 at 21:46
  • It looks like CImg does not require a library so there is noting to add to your linker settings for CImg. – drescherjm Aug 31 '16 at 21:48
  • `CImg` is a *header-only* library, that means you only need to either put `Cimg.h` in the directory with all your own files or set the `Include directories` or `Header directories` to have the path to wherever you have saved `CImg.h`. There is nothing to link, unless you use `X11` (on Linux/OSX), `pthreads`, `libpng`, `libjpeg` or `gdi32` (on Windows). – Mark Setchell Sep 12 '16 at 10:11

0 Answers0