Cimg library

hi
does anyone worked with cimg library? (http://cimg.sourceforge.net/index.shtml)
if you did pleas tell me how to work with that library.
when i write a program including this library i get stack overflow . why??

Because you're making too big a variable on the stack, or you're got your code wrong and you've got a function calling itself recursively over and over and over and over until you run out of memory on the stack.
#include <cimg.h>
using namespace cimg_library;
int main(){
CImg<int> image("lena.jpg");
return 0 ;
}

i got stack overflow in this.
Do you have a file named lena.jpg in the place the program is looking?
yes.
out put is this.

'9.exe': Loaded 'C:\Users\mehran\Documents\Visual Studio 2010\Projects\9\Debug\9.exe', Symbols loaded.
'9.exe': Loaded 'C:\Windows\System32\ntdll.dll', Cannot find or open the PDB file
'9.exe': Loaded 'C:\Windows\System32\kernel32.dll', Cannot find or open the PDB file
'9.exe': Loaded 'C:\Windows\System32\KernelBase.dll', Cannot find or open the PDB file
'9.exe': Loaded 'C:\Windows\System32\user32.dll', Cannot find or open the PDB file
'9.exe': Loaded 'C:\Windows\System32\gdi32.dll', Cannot find or open the PDB file
'9.exe': Loaded 'C:\Windows\System32\lpk.dll', Cannot find or open the PDB file
'9.exe': Loaded 'C:\Windows\System32\usp10.dll', Cannot find or open the PDB file
'9.exe': Loaded 'C:\Windows\System32\msvcrt.dll', Cannot find or open the PDB file
'9.exe': Loaded 'C:\Windows\System32\shell32.dll', Cannot find or open the PDB file
'9.exe': Loaded 'C:\Windows\System32\shlwapi.dll', Cannot find or open the PDB file
'9.exe': Loaded 'C:\Windows\System32\msvcr100d.dll', Symbols loaded.
'9.exe': Loaded 'C:\Windows\System32\imm32.dll', Cannot find or open the PDB file
'9.exe': Loaded 'C:\Windows\System32\msctf.dll', Cannot find or open the PDB file
First-chance exception at 0x755e9673 in 9.exe: Microsoft C++ exception: cimg_library::CImgIOException at memory location 0x00122fa4..
First-chance exception at 0x755e9673 in 9.exe: Microsoft C++ exception: cimg_library::CImgIOException at memory location 0x001120f4..
First-chance exception at 0x755e9673 in 9.exe: Microsoft C++ exception: cimg_library::CImgIOException at memory location 0x000fd240..
First-chance exception at 0x755e9673 in 9.exe: Microsoft C++ exception: cimg_library::CImgIOException at memory location 0x0006bb28..
First-chance exception at 0x755e9673 in 9.exe: Microsoft C++ exception: cimg_library::CImgIOException at memory location 0x0005f3a4..
First-chance exception at 0x755e9673 in 9.exe: Microsoft C++ exception: cimg_library::CImgIOException at memory location 0x0012f0d4..
First-chance exception at 0x014721e7 in 9.exe: 0xC00000FD: Stack overflow.
Unhandled exception at 0x014721e7 in 9.exe: 0xC00000FD: Stack overflow.
CImg will throw an exception if the file is not found. Are you really, really sure that the file is where the program is looking for it? Be aware that under Visual Studio working directory is typically not the same directory that the code is in, and sometimes it's not even the directory the program is running in. lena.jpg is not provided with the CImg files, so where did you get it and where did you put it?
Last edited on
ok
im not sure where should i copy lena.jpg
can you help me.
i just copied it to directory that the code is in.

You need to find which directory is the "working directory". This is probably the directory that Visual Studio is placing the executable program it builds.

Alternatively, give the full path to the file:

CImg<int> image("C:/someDirectory/someOtherDirectory/lena.jpg");
Last edited on
thank u
but i got same out put.
since im a beginner i think my problem is more basic.
i just downloaded (cimg.h) from http://cimg.sourceforge.net/index.shtml and pasted it to (D:\visual studio 2010\VC\include) .
should i do any thing more or thats enough ?



Download the whole package

http://sourceforge.net/projects/cimg/files/
Last edited on
Topic archived. No new replies allowed.