It Must make with libjpeg
you can make it with command g++ tobmp.cpp -ljpeg
it must be make with libjpeg .and it can convert jpeg to bmp565