Cimg library

Feb 12, 2012 at 5:22pm
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??

Feb 12, 2012 at 5:23pm
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.
Feb 12, 2012 at 5:28pm
#include <cimg.h>
using namespace cimg_library;
int main(){
CImg<int> image("lena.jpg");
return 0 ;
}

i got stack overflow in this.
Feb 12, 2012 at 5:37pm
Do you have a file named lena.jpg in the place the program is looking?
Feb 12, 2012 at 5:44pm
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.
Feb 12, 2012 at 5:51pm
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 Feb 12, 2012 at 5:56pm
Feb 12, 2012 at 5:56pm
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.

Feb 12, 2012 at 6:02pm
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 Feb 12, 2012 at 6:05pm
Feb 12, 2012 at 6:20pm
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 ?


Feb 12, 2012 at 6:33pm

Download the whole package

http://sourceforge.net/projects/cimg/files/
Last edited on Feb 12, 2012 at 6:34pm
Topic archived. No new replies allowed.