opengl-freeimage error

hi,

im having problem trying to use freeimage. but the error i got, i dont think its a freeimage related. i got a memory bad access which is really weird. here is the code:

http://pastebin.com/yH0kixKj

and the output:

run
[Switching to process 3290]
Running…
The size of the image is: 2.bmp es 1440*900
finish
what?
Program received signal: “EXC_BAD_ACCESS”.
sharedlibrary apply-load-rules all
(gdb)

i print “what?” just right after this line:

std::cerr << “what?” << std::endl;
glGenTextures(1, &texname);

which makes me think that the error is related to texname. but if you see the code, it doesnt actually make sense. can anyone help me on this one?

thanks in advance

ps: im using osx, ide xcode 3.1 if thats matter.

=================================
http://www.svnstrk.blogspot.com