Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
D
dlib
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
钟尚武
dlib
Commits
eee0d295
Commit
eee0d295
authored
Jan 17, 2016
by
Davis King
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improved error message you get about linking to libjpeg and libpng
if you try to open a jpeg or png file.
parent
da6e4807
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
4 deletions
+27
-4
load_image.h
dlib/image_loader/load_image.h
+27
-4
No files found.
dlib/image_loader/load_image.h
View file @
eee0d295
...
...
@@ -9,6 +9,7 @@
#include "jpeg_loader.h"
#include "image_loader.h"
#include <fstream>
#include <sstream>
namespace
dlib
{
...
...
@@ -71,15 +72,37 @@ namespace dlib
if
(
im_type
==
image_file_type
::
JPG
)
{
throw
image_load_error
(
"Unable to load image in file "
+
file_name
+
".
\n
"
+
std
::
ostringstream
sout
;
sout
<<
"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."
);
"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
)
{
throw
image_load_error
(
"Unable to load image in file "
+
file_name
+
".
\n
"
+
std
::
ostringstream
sout
;
sout
<<
"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."
);
"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
{
...
...
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