How use dlib in Xcode C++? - c++

I have installed dlib using Homebrew.
brew install dlib
Did this:
Add /usr/local/Cellar/dlib/19.16/include to Header Search Paths
Add /usr/local/Cellar/dlib/19.16/lib to Library Search Paths
Add -ldlib to Other Linker Flags
Add Accelerate.framework and change status to "Required" in Link Binary With Libraries
But when I include dlib's .h files have error:
Undefined symbols for architecture x86_64:
"_USER_ERROR__missing_dlib_all_source_cpp_file__OR__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 x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
P.S. Yes, i used -v, but it's no effects

Related

Working on CS106B through SEE, continued "ld: symbol(s) not found for architecture x86_64" errors when using their libraries

I'm using Eclipse and have been including the relevant libraries in the project folder as I build. Now that I'm a bit further in the course, I'm trying to
#include "vector.h"
but building gives 16 warnings that look like:
In file included from ../CS106B_Prog_Ass01_05.cpp:6:
Finished building: ../CS106B_Prog_Ass01_05.cpp
../vector.h:560:26: warning: range-based for loop is a C++11 extension [-Wc++11-extensions]
and the following error that prevents the project from building:
Undefined symbols for architecture x86_64:
"mainWrapper(int, char**)", referenced from:
_main in CS106B_Prog_Ass01_05.o
"__mainFlags", referenced from:
_main in CS106B_Prog_Ass01_05.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [CS106B_Prog_Ass01_05] Error 1
I would love to simply link to the library folder, but that results in a similar error even if I switch it to a different architecture. Has anyone had this problem?

Undefined symbols for architecture x86_64: "_SSLv2_ ..."

I am trying to build a small example for a Telegram Bot library in C++ (https://github.com/reo7sp/tgbot-cpp#samples) but when linking I get this output:
Undefined symbols for architecture x86_64:
"_SSLv2_client_method", referenced from:
boost::asio::ssl::context::context(boost::asio::ssl::context_base::method) in libTgBot.a(HttpClient.cpp.o)
"_SSLv2_method", referenced from:
boost::asio::ssl::context::context(boost::asio::ssl::context_base::method) in libTgBot.a(HttpClient.cpp.o)
"_SSLv2_server_method", referenced from:
boost::asio::ssl::context::context(boost::asio::ssl::context_base::method) in libTgBot.a(HttpClient.cpp.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
using this command:
g++ -std=c++11 main.cpp -l boost_system -l boost_iostreams -l boost_unit_test_framework -l boost_exception -l TgBot -l pthread -l ssl -l crypto -L/usr/local/opt/openssl/lib -I/usr/local/opt/openssl/include
I have openssl 1.0.2 installed: do I have to get a 2.x version? I can't find it with homebrew (my system is OSX 10.9.5)... sorry for the newbie question.
brew install openssl
open ~/.bash_profile
add
export PATH="/usr/local/opt/openssl/bin:$PATH"
export LDFLAGS="-L/usr/local/opt/openssl/lib"
export CPPFLAGS="-I/usr/local/opt/openssl/include"
source ~/.bash_profile

Integrating jsoncpp by including amalgamated source in Xcode

I'm struggling with a Linker error in Xcode. I've created the amalgamated source, added the jsoncpp.cpp as a source file to my project, I've set the header search path to jsoncpp-master/dist and use
#include "json/json.h"
#include "json/json-forwards.h"
as described at https://github.com/open-source-parsers/jsoncpp. Still, I'm getting an undefined symbols error:
Undefined symbols for architecture x86_64:
"output(Json::Value)", referenced from:
_main in main.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I found that it works if json/json.h, json/json-forward.h and jsoncpp.cpp are copied to the project directory. jsoncpp.cpp is added as a source file and json/json.h as a header. However, NO additional header search paths are set.

Apple Mach-O linker error: Undefined symbols for architecture i386 Google Protobuf

I am trying to use Protobuf 2.6 with Xcode version 6.3. I've added the libprotobuf-lite.a to my Demo application and added the path to the Header files in the Header Search Paths., but I am getting this error.
Undefined symbols for architecture i386:
"google::protobuf::io::StringOutputStream::StringOutputStream(std::string*)",
referenced from:
attributes::MergePartialFromCodedStream(google::protobuf::io::CodedInputStream*)
in attributes.pb.o ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see
invocation)

how to compile C++ - libsndfile on iOS

ld: warning: ignoring file /Users/vibhavarirajadnya/MyDev/iOS-Projects/Music/POC/ReadWaveFile/ReadWaveFile/libsndfile.a, file was built for archive which is not the architecture being linked (i386): /Users/vibhavarirajadnya/MyDev/iOS-Projects/Music/POC/ReadWaveFile/ReadWaveFile/libsndfile.a
Undefined symbols for architecture i386:
"_sf_close", referenced from:
SndfileHandle::SNDFILE_ref::~SNDFILE_ref() in ReadWaveFile.o
"_sf_open", referenced from:
SndfileHandle::SndfileHandle(char const*, int, int, int, int) in ReadWaveFile.o
"_sf_strerror", referenced from:
SndfileHandle::strError() const in ReadWaveFile.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I tried compiling libsndfile file in 3 ways:
1. ./configure then make and make install through command prompt.
2. http://ofdsp.blogspot.in/2011/07/installing-libsndfile-with-xcode.html
3. http://en.efreedom.net/Question/1-11576168/Cross-Compile-Libsndfile-Arm-Raspberry-Pi
With the first option I am getting the error mentioned above. With the second, I am getting some 69 errors most of them related to FLAC. With the third option I am getting the same as 1. It also gives a msg in the command prompt:
Installation directories :
Library directory : ................... /Users/vibhavarirajadnya/Arm/lib
Program directory : ................... /Users/vibhavarirajadnya/Arm/bin
Pkgconfig directory : ................. /Users/vibhavarirajadnya/Arm/lib/pkgconfig
HTML docs directory : ................. /Users/vibhavarirajadnya/Arm/share/doc/libsndfile1-dev/html
But when I check in Finder, there is no such directory.
Can somebody tell me a step by step method to compile libsndfile and its dependencies for Mac iOSX?