Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
dlib
Commits
eee0d295
Commit
eee0d295
authored
Jan 17, 2016
by
Davis King
Browse files
Improved error message you get about linking to libjpeg and libpng
if you try to open a jpeg or png file.
parent
da6e4807
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
6 deletions
+29
-6
dlib/image_loader/load_image.h
dlib/image_loader/load_image.h
+29
-6
No files found.
dlib/image_loader/load_image.h
View file @
eee0d295
...
@@ -9,6 +9,7 @@
...
@@ -9,6 +9,7 @@
#include "jpeg_loader.h"
#include "jpeg_loader.h"
#include "image_loader.h"
#include "image_loader.h"
#include <fstream>
#include <fstream>
#include <sstream>
namespace
dlib
namespace
dlib
{
{
...
@@ -71,15 +72,37 @@ namespace dlib
...
@@ -71,15 +72,37 @@ namespace dlib
if
(
im_type
==
image_file_type
::
JPG
)
if
(
im_type
==
image_file_type
::
JPG
)
{
{
throw
image_load_error
(
"Unable to load image in file "
+
file_name
+
".
\n
"
+
std
::
ostringstream
sout
;
"You must #define DLIB_JPEG_SUPPORT and link to libjpeg to read JPEG files.
\n
"
+
sout
<<
"Unable to load image in file "
+
file_name
+
".
\n
"
+
"Do this by following the instructions at http://dlib.net/compile.html."
);
"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.
\n\n
"
;
#ifdef _MSC_VER
sout
<<
"Note that you must cause DLIB_JPEG_SUPPORT to be defined for your entire project.
\n
"
;
sout
<<
"So don't #define it in one file, add it to the C/C++->Preprocessor->Preprocessor Definitions
\n
"
;
sout
<<
"field in Visual Studio's Property Pages window so it takes effect for your entire application."
;
#else
sout
<<
"Note that you must cause DLIB_JPEG_SUPPORT to be defined for your entire project.
\n
"
;
sout
<<
"So don't #define it in one file, use a compiler switch like -DDLIB_JPEG_SUPPORT
\n
"
;
sout
<<
"so it takes effect for your entire application."
;
#endif
throw
image_load_error
(
sout
.
str
());
}
}
else
if
(
im_type
==
image_file_type
::
PNG
)
else
if
(
im_type
==
image_file_type
::
PNG
)
{
{
throw
image_load_error
(
"Unable to load image in file "
+
file_name
+
".
\n
"
+
std
::
ostringstream
sout
;
"You must #define DLIB_PNG_SUPPORT and link to libpng to read PNG files.
\n
"
+
sout
<<
"Unable to load image in file "
+
file_name
+
".
\n
"
+
"Do this by following the instructions at http://dlib.net/compile.html."
);
"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.
\n\n
"
;
#ifdef _MSC_VER
sout
<<
"Note that you must cause DLIB_PNG_SUPPORT to be defined for your entire project.
\n
"
;
sout
<<
"So don't #define it in one file, add it to the C/C++->Preprocessor->Preprocessor Definitions
\n
"
;
sout
<<
"field in Visual Studio's Property Pages window so it takes effect for your entire application.
\n
"
;
#else
sout
<<
"Note that you must cause DLIB_PNG_SUPPORT to be defined for your entire project.
\n
"
;
sout
<<
"So don't #define it in one file, use a compiler switch like -DDLIB_PNG_SUPPORT
\n
"
;
sout
<<
"so it takes effect for your entire application."
;
#endif
throw
image_load_error
(
sout
.
str
());
}
}
else
else
{
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment