HalfdanJ / ofxFaceTracker2

Landmark detection addon for openFrameworks using DLIB
Other
209 stars 60 forks source link

Error D8016 '/RTC1' and '/O2' command-line options are incompatible #21

Open SuperMoran opened 7 years ago

SuperMoran commented 7 years ago

Hi, I am using thexFaceTracker2 when there is a problem, add the plugin, do not add code to run will appear '/ RTC1' and '/ O2 error, can you help me, thanks

SuperMoran commented 7 years ago

@HalfdanJ please help me

HalfdanJ commented 7 years ago

Sorry, but I don't understand your problem. Don't know what rtc1 means

SuperMoran commented 7 years ago

I use the visual studio 2015, I would like to ask the use ofxFaceTracker2 what needs to build what environment, because the compiler will show unresolved external symbol

HalfdanJ commented 7 years ago

I'm sorry, I dont have experience with visual studio. I would probably recommend you look at ofxDlib

sebasobotka commented 7 years ago

Hi @SuperMoran. I am using VS2015 and I've got the same error. Here is more info about this problem: http://stackoverflow.com/questions/23179136/visual-studio-command-line-error-d8016-ox-and-rtc-command-line-options-a

  1. Switching to release mode helps. It goes farther. or
  2. Deleting the Command line option in Project->Properties->C/C++->Command Line->Additional Options. You need to do it for all configurations and platforms. I checked the "Inherit from parent..." option also. The same situation here. It goes farther but we need to compile in release mode anyway because there is no dlib.lib for debug mode compiled.

EDIT! This special flag -O2 is passed by addon_config.mk file. Delete it and no need to delete it manually in each example-project.

vs_command_line_error

Finally I got it.

  1. "CreateSemaphore not found" - fixed in window_magic.h
  2. "Error D8016 '/RTC1' and '/O2' command-line options are incompatible" - compiling in release mode or changing Command Line options.
  3. Add to Project Property -> Configuration Properties -> Linker -> Additional Library Directories path to addons\ofxFaceTracker2\libs\dlib\lib\win\Release
  4. Add "dlib.lib" value to Project Property -> Configuration Properties -> Linker -> Input -> Additional...
  5. Copy "shape_predictor_68_face_landmarks.dat" to bin\data folder some changes in setup() _string predictorDatFilePath = ofToDataPath("shape_predictor_68_facelandmarks.dat"); tracker.setup(predictorDatFilePath);
  6. There is no preprocessor flag OPTIMIZE in Visual Studio... I fixed it in this way or we can delete it.. _#ifndef TARGET_WIN32

    ifndef OPTIMIZE

    ofSetColor(ofColor::red);
    ofDrawBitmapString("Warning! Run this app in release mode to get proper performance!",10,60);
    ofSetColor(ofColor::white);

    endif

    endif_

Bendegreef commented 7 years ago

hi @sebasobotka ,

Thanks for the instructions! But i'm still getting "cannot open input file 'dlib.lib'.

I'm sure I followed your instructions right.

Any idea?

Thanks!

sebasobotka commented 7 years ago

Be sure that you have that file in folder /libs/dlib/lib/win/Release Check the Configuration and Platform options marked by red rectangle out, there are 4 possibilities: debug win32 release win32 debug x64 release x64 The static lib file was compiled for 64 bit so you need to compile project in Release mode, x64 and set path and input for Release and x64.

linker_option01 linker_option02

SuperMoran commented 7 years ago

hi @sebasobotka

Thanks for the instructions! It's very helpful to me.

sebasobotka commented 7 years ago

Please, read again above carefully. You need to have compiled library (dlib) to static file (in your case in 64bit mode) and add it as described above. Chosen platform is very important.

teganscott commented 6 years ago

Hi @sebasobotka

I'm getting the 'CreateSemaphore' error, and you said the fix was in the window_magic.h file. What exactly did you do to this file to make it work?

Thanks!

sebasobotka commented 6 years ago

Hi @teganscott, Please check my file: https://github.com/sebasobotka/ofxFaceTracker2/blob/master/libs/dlib/include/dlib/windows_magic.h These lines are important:

#ifdef WIN32

#ifndef CreateSemaphore
#ifdef UNICODE
#define CreateSemaphore CreateSemaphoreW
#endif
#endif
teganscott commented 6 years ago

Thank you! That fixed it!

mhaghighat commented 6 years ago

Right click on the project in the Solution Explorer and click on Properties and go to: Configuration Properties => C/C++ => Code Generation Set the "Basic Runtime Checks" to "Default". You'll be OK then.

image

gbernal commented 5 years ago

Thank you, everyone, for the collective effort, a lot of the pointers help me get rid of errors, however, I'm getting more errors now.

Severity Code Description Project File Line Suppression State Error LNK1120 9 unresolved externals facetracking01 C:\Users\gbernal\Documents\of_v0.9.8_vs_release\apps\myApps\facetracking01\bin\facetracking01.exe 1 Error LNK2001 unresolved external symbol "public: unsigned int __cdecl dlib::entropy_decoder_kernel_2::get_target(unsigned int)" (?get_target@entropy_decoder_kernel_2@dlib@@QEAAII@Z) facetracking01 C:\Users\gbernal\Documents\of_v0.9.8_vs_release\apps\myApps\facetracking01\ofxFaceTracker2.obj 1 Error LNK2001 unresolved external symbol "public: virtual __cdecl dlib::base64::~base64(void)" (??1base64@dlib@@UEAA@XZ) facetracking01 C:\Users\gbernal\Documents\of_v0.9.8_vs_release\apps\myApps\facetracking01\ofxFaceTracker2.obj 1 Error LNK2001 unresolved external symbol "public: virtual __cdecl dlib::entropy_decoder_kernel_2::~entropy_decoder_kernel_2(void)" (??1entropy_decoder_kernel_2@dlib@@UEAA@XZ) facetracking01 C:\Users\gbernal\Documents\of_v0.9.8_vs_release\apps\myApps\facetracking01\ofxFaceTracker2.obj 1 Error LNK2001 unresolved external symbol "public: void __cdecl dlib::base64::decode(class std::basic_istream<char,struct std::char_traits<char> > &,class std::basic_ostream<char,struct std::char_traits<char> > &)const " (?decode@base64@dlib@@QEBAXAEAV?$basic_istream@DU?$char_traits@D@std@@@std@@AEAV?$basic_ostream@DU?$char_traits@D@std@@@4@@Z) facetracking01 C:\Users\gbernal\Documents\of_v0.9.8_vs_release\apps\myApps\facetracking01\ofxFaceTracker2.obj 1 Error LNK2001 unresolved external symbol "public: void __cdecl dlib::entropy_decoder_kernel_2::decode(unsigned int,unsigned int)" (?decode@entropy_decoder_kernel_2@dlib@@QEAAXII@Z) facetracking01 C:\Users\gbernal\Documents\of_v0.9.8_vs_release\apps\myApps\facetracking01\ofxFaceTracker2.obj 1 Error LNK2001 unresolved external symbol "public: void __cdecl dlib::entropy_decoder_kernel_2::set_stream(class std::basic_istream<char,struct std::char_traits<char> > &)" (?set_stream@entropy_decoder_kernel_2@dlib@@QEAAXAEAV?$basic_istream@DU?$char_traits@D@std@@@std@@@Z) facetracking01 C:\Users\gbernal\Documents\of_v0.9.8_vs_release\apps\myApps\facetracking01\ofxFaceTracker2.obj 1 Error LNK2001 unresolved external symbol "public: __cdecl dlib::base64::base64(void)" (??0base64@dlib@@QEAA@XZ) facetracking01 C:\Users\gbernal\Documents\of_v0.9.8_vs_release\apps\myApps\facetracking01\ofxFaceTracker2.obj 1 Error LNK2001 unresolved external symbol "public: __cdecl dlib::entropy_decoder_kernel_2::entropy_decoder_kernel_2(void)" (??0entropy_decoder_kernel_2@dlib@@QEAA@XZ) facetracking01 C:\Users\gbernal\Documents\of_v0.9.8_vs_release\apps\myApps\facetracking01\ofxFaceTracker2.obj 1 Error LNK2001 unresolved external symbol USER_ERROR__missing_dlib_all_source_cpp_file__OR__inconsistent_use_of_DEBUG_or_ENABLE_ASSERTS_preprocessor_directives_ facetracking01 C:\Users\gbernal\Documents\of_v0.9.8_vs_release\apps\myApps\facetracking01\ofxFaceTracker2Landmarks.obj 1 Error LNK2001 unresolved external symbol USER_ERROR__missing_dlib_all_source_cpp_file__OR__inconsistent_use_of_DEBUG_or_ENABLE_ASSERTS_preprocessor_directives_ facetracking01 C:\Users\gbernal\Documents\of_v0.9.8_vs_release\apps\myApps\facetracking01\main.obj 1 Error LNK2001 unresolved external symbol USER_ERROR__missing_dlib_all_source_cpp_file__OR__inconsistent_use_of_DEBUG_or_ENABLE_ASSERTS_preprocessor_directives_ facetracking01 C:\Users\gbernal\Documents\of_v0.9.8_vs_release\apps\myApps\facetracking01\ofApp.obj 1 Error LNK2001 unresolved external symbol USER_ERROR__missing_dlib_all_source_cpp_file__OR__inconsistent_use_of_DEBUG_or_ENABLE_ASSERTS_preprocessor_directives_ facetracking01 C:\Users\gbernal\Documents\of_v0.9.8_vs_release\apps\myApps\facetracking01\ofxFaceTracker2.obj 1 Error LNK2001 unresolved external symbol USER_ERROR__missing_dlib_all_source_cpp_file__OR__inconsistent_use_of_DEBUG_or_ENABLE_ASSERTS_preprocessor_directives_ facetracking01 C:\Users\gbernal\Documents\of_v0.9.8_vs_release\apps\myApps\facetracking01\ofxFaceTracker2Instance.obj 1