Dear all,
When I compile this program:
include <dlib image_processing="" frontal_face_detector.h="">
include <dlib gui_widgets.h="">
include <dlib image_io.h="">
On OSX 10.10 (i386 or x64 tried every possible combination), i get:
Undefined symbols for architecture i386:
"_USER_ERRORmissing_dlib_all_source_cpp_fileOR__inconsistent_use_of_DEBUG_or_ENABLE_ASSERTS_preprocessor_directives", referenced from:
_dlib_check_consistent_assert_usage in main.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I spend hours trying to figure out what is going on.
Can you help?
If I use a very old version (Version: 17.46) there are no issues however i dont have frontal_face_detector.h in the old version!
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
So you run cmake. Compile it, and you get a linker error? What error? The
USER_ERRORmissing_dlib_all_source_cpp_fileOR__inconsistent_use_of_DEBUG_or_
ENABLE_ASSERTS_preprocessor_directives error?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
C++ projects are a bunch of .cpp files that are compiled together. I mean
you need to include dlib/all/source.cpp in the list of .cpp files that are
part of your project.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
X11 errors.
But wait,
The examples successfully compiled and LINKED when using Cmake.
I was also able to run bayes_net_gui_ex
and I tested it to see that it is actually x86_64 as follows and it is indeed:
Dear all,
When I compile this program:
include <dlib image_processing="" frontal_face_detector.h="">
include <dlib gui_widgets.h="">
include <dlib image_io.h="">
On OSX 10.10 (i386 or x64 tried every possible combination), i get:
Undefined symbols for architecture i386:
"_USER_ERRORmissing_dlib_all_source_cpp_fileOR__inconsistent_use_of_DEBUG_or_ENABLE_ASSERTS_preprocessor_directives", referenced from:
_dlib_check_consistent_assert_usage in main.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I spend hours trying to figure out what is going on.
Can you help?
If I use a very old version (Version: 17.46) there are no issues however i dont have frontal_face_detector.h in the old version!
Hi,
Are you able to compile frontal_face_detector.h using Xcode with the latest dlib version?
Thanks,
I don't have an OS X machine around to test on. So someone else will have to answer this :)
Thanks, I understand :)
I tested on two OSX machine and both have exactly the same issue.
These are my xcode settings, linking still fails with the attached error. I am sure everything was compiled using x86_64
The error
Did you compile it with cmake?
what does _dlib_check_consistent_assert_usage linking error in main.o means?
It means you might have compiled different .cpp files with different settings (which is illegal in C++) and dlib tells you about it.
The examples with Cmake, the small program with Xcode
So did building it with cmake work?
Yes, it did, I wrote that it did so on the other thread.
Linking does not work, so I can not run anything.
So you run cmake. Compile it, and you get a linker error? What error? The
USER_ERRORmissing_dlib_all_source_cpp_fileOR__inconsistent_use_of_DEBUG_or_
ENABLE_ASSERTS_preprocessor_directives error?
just to make sure:
Compiling dlib examples with cmake works
Linking using Xcode fails.
This is the program:
include <iostream>
include <dlib image_processing="" frontal_face_detector.h="">
include <dlib gui_widgets.h="">
include <dlib image_io.h="">
int main(int argc, const char * argv[]) {
// insert code here...
std::cout << "Hello, World!\n";
return 0;
}
1- I use Cmake, compile all the examples.
2- Then I use xcode->create a new CPP project
3- Then I include frontal_face_detector.h and get the error.
So you aren't using cmake at all in xcode? Did you add dlib/all/source.cpp into your project?
No, I am using Xcode tools.
What did you mean by "Did you add dlib/all/source.cpp into your project?" in the header search path???
C++ projects are a bunch of .cpp files that are compiled together. I mean
you need to include dlib/all/source.cpp in the list of .cpp files that are
part of your project.
Numerous compilation errors.
The odd thing is that https://github.com/genekogan/ofxLearn which uses dlib 17.49 fully works on OSX and Xcode.
But that old version does not include new features that I want to test.
What error?
X11 errors.
But wait,
The examples successfully compiled and LINKED when using Cmake.
I was also able to run bayes_net_gui_ex
and I tested it to see that it is actually x86_64 as follows and it is indeed:
build freebsd$ file bayes_net_gui_ex
bayes_net_gui_ex: Mach-O 64-bit executable x86_64
So,
what ever is happening, it is related to Xcode. I have no option but to use Xcode.
See the screenshot.
Can you please indicate all the CMAKE options and CPP/C/CXX flags you are using?
And of course,
thank you very much for all your help
You can tell cmake to make an xcode project. You do it like this:
cd examples
mkdir build2
cd build2
cmake -G Xcode ..
Finally!!!
Thanks!
i was just about to move to another lib after two days of failed attempts.
once again,
thanks,
highly appreciated.
No problem. Thanks for the bug report :)