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
4934b002
"docs/vscode:/vscode.git/clone" did not exist on "efb73fcb598fbb93c6cae7d6667a58b373b0de96"
Commit
4934b002
authored
Apr 26, 2014
by
Davis King
Browse files
Made the ODR rule violation error diagnostic clearer.
parent
2d7e320a
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
4 deletions
+35
-4
dlib/threads/threads_kernel_shared.cpp
dlib/threads/threads_kernel_shared.cpp
+1
-1
dlib/threads/threads_kernel_shared.h
dlib/threads/threads_kernel_shared.h
+34
-3
No files found.
dlib/threads/threads_kernel_shared.cpp
View file @
4934b002
...
...
@@ -9,7 +9,7 @@
#include <iostream>
// The point of this block of code is to cause a link time error that will prevent a user
// from compiling part of their application with DLIB_ASSERT
s
enabled and part with them
// from compiling part of their application with DLIB_ASSERT enabled and part with them
// disabled since doing that would be a violation of C++'s one definition rule.
extern
"C"
{
...
...
dlib/threads/threads_kernel_shared.h
View file @
4934b002
...
...
@@ -13,11 +13,29 @@
#include "../queue.h"
#include "../set.h"
// The point of this block of code is to cause a link time error that will prevent a user
// from compiling part of their application with DLIB_ASSERTs enabled and part with them
// disabled since doing that would be a violation of C++'s one definition rule.
extern
"C"
{
// =========================>>> WHY YOU ARE GETTING AN ERROR HERE <<<=========================
// The point of this block of code is to cause a link time error that will prevent a user
// from compiling part of their application with DLIB_ASSERT enabled and part with it
// disabled since doing that would be a violation of C++'s one definition rule. So if you
// are getting an error here then you are either not enabling DLIB_ASSERT consistently
// (e.g. by compiling part of your program in a debug mode and part in a release mode) or
// you have simply forgotten to compile dlib/all/source.cpp into your application.
// =========================>>> WHY YOU ARE GETTING AN ERROR HERE <<<=========================
#ifdef ENABLE_ASSERTS
extern
int
USER_ERROR__violation_of_one_definition_rule_detected__inconsistent_use_of_DEBUG_or_ENABLE_ASSERTS_preprocessor_directives
;
inline
int
dlib_check_consistent_assert_usage
()
{
USER_ERROR__violation_of_one_definition_rule_detected__inconsistent_use_of_DEBUG_or_ENABLE_ASSERTS_preprocessor_directives
=
0
;
return
0
;
}
...
...
@@ -28,6 +46,19 @@ extern "C"
const
int
dlib_check_assert_helper_variable
=
dlib_check_consistent_assert_usage
();
}
namespace
dlib
{
...
...
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