opengl-freeimage error


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:

and the output:

[Switching to process 3290]
The size of the image is: 2.bmp es 1440*900
Program received signal: “EXC_BAD_ACCESS”.
sharedlibrary apply-load-rules all

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.