   jpeg_create_decompress (jpeg.lib) fails
  Stange one:on calling jpeg_create_decompress(&jpeg_struct); my app just quits out (or dies to be exact) no errors, nothing.. and stepping through it, an f10 or f11 on the above line just quits the debugger...does anyone have any ideas what might be causing this? i''m using the JPEG lib files from www.gametutorials.comthanks   -----------------------"Without a sense of humour we couldn''t react to a lot of things" 
  How are you initializing the lib ? Try this, straight from the libjpeg docs. Works for me. #include "jpeglib.h"#include "readjpeg.h"struct my_error_mgr {struct jpeg_error_mgr pub;// "public" fieldsjmp_buf setjmp_buffer;// for return to caller};typedef struct my_error_mgr *my_error_ptr;METHODDEF(void) my_error_exit (j_common_ptr cinfo){// cinfo->err really points to a my_error_mgr struct, so coerce pointermy_error_ptr myerr = (my_error_ptr) cinfo->err;// Return control to the setjmp pointlongjmp(myerr->setjmp_buffer, 1);}bool jpeg::LoadImage(const string &fname, SImageInfo *ImageInfo){   struct jpeg_decompress_struct cinfo;// Open the image fileFILE *fp = fopen(fname.c_str(), "rb"); if( !fp ) return( false );// We set up the normal JPEG error routines, then override error_exitstruct my_error_mgr jerr;cinfo.err = jpeg_std_error(&jerr.pub);jerr.pub.error_exit = my_error_exit;// Establish the setjmp return context for my_error_exit to useif( setjmp(jerr.setjmp_buffer) ) {// If we get here, the JPEG code has signaled an error.// We need to clean up the JPEG object, close the input file, and return.jpeg_destroy_decompress(&cinfo);fclose(fp);return( false );}// Now we can initialize the JPEG decompression objectjpeg_create_decompress(&cinfo);// specify the data sourcejpeg_stdio_src(&cinfo, fp);// read file parameters with jpeg_read_header()jpeg_read_header(&cinfo, TRUE);// Start decompressorjpeg_start_decompress(&cinfo);// Make a one-row-high sample array that will go away when done with imageint rowstride = cinfo.output_width * cinfo.output_components;JSAMPARRAY buffer = (*cinfo.mem->alloc_sarray)((j_common_ptr) &cinfo, JPOOL_IMAGE, rowstride, 1);// Get memory for local imagechar *data = new char[cinfo.output_height * rowstride];// Read all scanlinesint y = 0;  while( cinfo.output_scanline < cinfo.output_height ) {jpeg_read_scanlines(&cinfo, buffer, 1);// insert the row into the global imagememcpy(&data[y*rowstride], buffer[0], rowstride);y++;}// Fill in ImageInfo structImageInfo->xsize = cinfo.output_width;ImageInfo->ysize = cinfo.output_height;ImageInfo->bpp = cinfo.output_components * 8;ImageInfo->alpha = false;ImageInfo->indexed = false;ImageInfo->format = ( cinfo.output_components > 1 ) ? RGB : GREY;ImageInfo->data = data;ImageInfo->palette = NULL;// Finish decompressionjpeg_finish_decompress(&cinfo);// Release JPEG decompression objectjpeg_destroy_decompress(&cinfo);// Close the input filefclose(fp);// At this point, check to see whether any corrupt-data warnings occurredif( jerr.pub.num_warnings ) return( false );return( true );};  Thanks for the reply, but it didn;t solve my problem...i''ve included the full header and C file for the lpeg loader #ifndef __JPGLOADER_H__#define __JPGLOADER_H__#include <vector>#include "StdAfx.h"#include "jpeglib.h"#pragma comment(lib, "jpeg.lib")using namespace std;class CJpgLoader{  public:    //To store an JPEG images for mipmap creation    tImageJPG *m_jpeg_image;    struct jpeg_decompress_struct jpeg_struct;    public: CJpgLoader (); ~CJpgLoader (); loadJpeg (const char* filename); void decodeJpeg (jpeg_decompress_struct* info);};#endifand eh .cpp file #include "jpgloader.h"CJpgLoader::CJpgLoader (){}CJpgLoader::~CJpgLoader (){  if (m_jpeg_image)// If we loaded the image  {    if (m_jpeg_image->data)// If there is texture data    { free(m_jpeg_image->data);// Free the texture data, we don''t need it anymore    }    free(m_jpeg_image);// Free the image structure  }}/*============================================================*\Author :SvenDate : 24/07/03version 1.0  ============================================================Function :decode_jpegDescription :Return :void-Parameters :jpeg_decompress_struct* info-tImageJPG *p_image_data-Note :\*============================================================*/void CJpgLoader::decodeJpeg (jpeg_decompress_struct* info){  // Read in the header of the jpeg filejpeg_read_header(info, TRUE);// Start to decompress the jpeg file with our compression infojpeg_start_decompress(&jpeg_struct);// Get the image dimensions and row span to read in the pixel datam_jpeg_image->rowSpan = jpeg_struct.image_width * jpeg_struct.num_components;m_jpeg_image->sizeX   = jpeg_struct.image_width;m_jpeg_image->sizeY   = jpeg_struct.image_height;// Allocate memory for the pixel bufferm_jpeg_image->data = new unsigned char[m_jpeg_image->rowSpan * m_jpeg_image->sizeY];// Here we use the library''s state variable cinfo.output_scanline as the// loop counter, so that we don''t have to keep track ourselves.// Create an array of row pointersunsigned char** rowPtr = new unsigned char*[m_jpeg_image->sizeY];for (int i = 0; i < m_jpeg_image->sizeY; i++)rowPtr[i] = &(m_jpeg_image->data[i*m_jpeg_image->rowSpan]);// Now comes the juice of our work, here we extract all the pixel dataint rowsRead = 0;while (jpeg_struct.output_scanline < jpeg_struct.output_height) {// Read in the current row of pixels and increase the rowsRead countrowsRead += jpeg_read_scanlines(&jpeg_struct, &rowPtr[rowsRead], jpeg_struct.output_height - rowsRead);}// Delete the temporary row pointersdelete [] rowPtr;// Finish decompressing the datajpeg_finish_decompress(&jpeg_struct);}/*============================================================*\Author :SvenDate : 24/07/03version 1.0  ============================================================Function :CTexture_manager::load_jpegDescription :Return :tImageJPGE *-Parameters :const char *filename-Note :\*============================================================*/CJpgLoader::loadJpeg (const char *filename){tImageJPG *pImageData = NULL;FILE *pFile;// This is the only function you should care about.  You don''t need to// really know what all of this does (since you can''t cause it''s a library!) :)// Just know that you need to pass in the jpeg file name, and get a pointer// to a tImageJPG structure which contains the width, height and pixel data.// Be sure to free the data after you are done with it, just like a bitmap.// Open a file pointer to the jpeg file and check if it was found and opened if((pFile = fopen(filename, "rb")) == NULL) {// Display an error message saying the file was not found, then return NULLMessageBox(g_hwnd, "Unable to load JPG File!", "Error", MB_OK);return NULL;}// Create an error handlerjpeg_error_mgr jerr;// Have our compression info object point to the error handler addressjpeg_struct.err = jpeg_std_error(&jerr);// Initialize the decompression objectjpeg_create_decompress(&jpeg_struct);// Specify the data source (Our file pointer)jpeg_stdio_src(&jpeg_struct, pFile);// Allocate the structure that will hold our eventual jpeg data (must free it!)m_jpeg_image = (tImageJPG*)malloc(sizeof(tImageJPG));// Decode the jpeg file and fill in the image data structure to pass backdecodeJpeg(&jpeg_struct);// This releases all the stored memory for reading and decoding the jpegjpeg_destroy_decompress(&jpeg_struct);// Close the file pointer that opened the filefclose(pFile);// Return the jpeg data (remember, you must free this data after you are done)return 1;}can anyone see anything wrong with this? or something missing?   -----------------------"Without a sense of humour we couldn''t react to a lot of things" ;  Hmm, I don''t have much experience with libjpeg. As I said, I simply modified the example that came with it, and it worked. Did you try the code I posted, does it crash at the same function ?OK, a stab in the dark: I see that you didn''t override the error handler, but use the default one. If I remember correctly, the default error behaviour of libjpeg is to abort execution, ie. hard exit. That could be the thing happening to you. Try to insert your own error handler, set a breakpoint in it, and you''ll quickly notice if some error occurred while initializing the lib.If all that doesn''t help, I''m out of ideas... Perhaps recompile the lib yourself, I tend to not trust precompiled libs found on the net.;  ta very much.. i''ll give that whirl and see what happens....thanks  -----------------------"Without a sense of humour we couldn''t react to a lot of things" 