From 0e259c4009e5edee751e6059293e9dbec8d21697 Mon Sep 17 00:00:00 2001 From: Davis King Date: Mon, 8 Dec 2014 08:26:43 -0500 Subject: [PATCH] Clarified the error message a user gets when they try to load a jpeg or png file but didn't link to the approrpiate library. --- dlib/image_loader/load_image.h | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/dlib/image_loader/load_image.h b/dlib/image_loader/load_image.h index 2a735576e..da311ab95 100644 --- a/dlib/image_loader/load_image.h +++ b/dlib/image_loader/load_image.h @@ -70,11 +70,21 @@ namespace dlib } if (im_type == image_file_type::JPG) - throw image_load_error("DLIB_JPEG_SUPPORT not #defined: Unable to load image in file " + file_name); + { + throw image_load_error("Unable to load image in file " + file_name + ".\n" + + "You must #define DLIB_JPEG_SUPPORT and link to libjpeg to read JPEG files.\n" + + "Do this by following the instructions at http://dlib.net/compile.html."); + } else if (im_type == image_file_type::PNG) - throw image_load_error("DLIB_PNG_SUPPORT not #defined: Unable to load image in file " + file_name); + { + throw image_load_error("Unable to load image in file " + file_name + ".\n" + + "You must #define DLIB_PNG_SUPPORT and link to libpng to read PNG files.\n" + + "Do this by following the instructions at http://dlib.net/compile.html."); + } else + { throw image_load_error("Unknown image file format: Unable to load image in file " + file_name); + } } }