I am trying to do a project in C++ with the help of curlcpp and cmake, but I am unable to compile the project.
I am new to CMakeLists and it is quite difficult to understand how to add the stuff you require to make your project work. I basically usually copy what I can find in other posts without really understanding how they work; tutorial and documentation is usually either too basic or to complex. To make things worse, I have the impression that each library is added differently so when there is a new one to add the only way I have to add it is to search for previous post asking how to do it. In this case I was unable to find anything that helped me.
So here is what I have done:
After installing curlpp and curl with homebrew
brew install curl
brew install curlpp
I write my project:
Cmakelists.txt:
cmake_minimum_required(VERSION 3.0)
project(stock_analysis)
set(CMAKE_CXX_FLAGS "-g -Wall -std=c++11")
######## BOOST STUFF ########
#DELETE NEXT LINE
set(Boost_NO_BOOST_CMAKE ON)
# set(Boost_USE_STATIC_LIBS ON) # only find static libs
# set(Boost_USE_MULTITHREADED ON)
# set(Boost_USE_STATIC_RUNTIME OFF)
find_package(Boost COMPONENTS
filesystem
)
######## CURL STUFF ########
include(FindCURL)
find_package(CURL REQUIRED)
if(CURL_FOUND)
message(STATUS "Found CURL version: ${CURL_VERSION_STRING}")
message(STATUS "Using CURL include dir(s): ${CURL_INCLUDE_DIRS}")
message(STATUS "Using CURL lib(s): ${CURL_LIBRARIES}")
else()
message(FATAL_ERROR "Could not find CURL")
endif()
SET(HEADERS
include
)
SET(SOURCE_FILES
src/main.cpp
src/analyse.cpp
src/helpers.cpp
src/simulation.cpp
src/data.cpp
)
include_directories(${HEADERS}
${Boost_INCLUDE_DIRS}
${CURL_INCLUDE_DIRS}
)
add_executable(app ${SOURCE_FILES})
target_link_libraries(app
${Boost_LIBRARIES}
${CURL_LIBRARIES}
)
Function in data.cpp (I basically copy the example in curlcpp webpage):
#include "data.h"
#include <iostream>
#include <curlpp/cURLpp.hpp>
#include <curlpp/Easy.hpp>
#include <curlpp/Options.hpp>
using namespace curlpp::options;
void fetchData(){
try
{
// That's all that is needed to do cleanup of used resources (RAII style).
curlpp::Cleanup myCleanup;
// Our request to be sent.
curlpp::Easy myRequest;
// Set the URL.
myRequest.setOpt<Url>("http://example.com");
// Send request and get a result.
// By default the result goes to standard output.
myRequest.perform();
}
catch( curlpp::RuntimeError &e )
{
std::cout << e.what() << std::endl;
}
catch( curlpp::LogicError &e )
{
std::cout << e.what() << std::endl;
}
}
The error I get:
Undefined symbols for architecture x86_64:
"curlpp::OptionBase::OptionBase(CURLoption)", referenced from:
curlpp::Option<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >::Option(CURLoption, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in data.cpp.o
"curlpp::OptionBase::~OptionBase()", referenced from:
curlpp::Option<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >::Option(CURLoption, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in data.cpp.o
curlpp::Option<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >::~Option() in data.cpp.o
"curlpp::UnsetOption::UnsetOption(char const*)", referenced from:
curlpp::Option<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >::updateMeToOption(curlpp::OptionBase const&) in data.cpp.o
curlpp::OptionTrait<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, (CURLoption)10002>::updateHandleToMe(curlpp::internal::CurlHandle*) const in data.cpp.o
curlpp::Option<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >::getValue() const in data.cpp.o
"curlpp::RuntimeError::~RuntimeError()", referenced from:
curlpp::UnsetOption::~UnsetOption() in data.cpp.o
"curlpp::libcurlRuntimeAssert(char const*, CURLcode)", referenced from:
void curlpp::internal::CurlHandle::option<void*>(CURLoption, void*) in data.cpp.o
"curlpp::Easy::perform()", referenced from:
StockAnalysis::fetchData(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, bool const&) in data.cpp.o
"curlpp::Easy::Easy()", referenced from:
StockAnalysis::fetchData(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, bool const&) in data.cpp.o
"curlpp::Easy::~Easy()", referenced from:
StockAnalysis::fetchData(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, bool const&) in data.cpp.o
"curlpp::Cleanup::Cleanup()", referenced from:
StockAnalysis::fetchData(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, bool const&) in data.cpp.o
"curlpp::Cleanup::~Cleanup()", referenced from:
StockAnalysis::fetchData(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, bool const&) in data.cpp.o
"curlpp::OptionBase::operator<(curlpp::OptionBase const&) const", referenced from:
vtable for curlpp::OptionTrait<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, (CURLoption)10002> in data.cpp.o
vtable for curlpp::Option<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > in data.cpp.o
"typeinfo for curlpp::LogicError", referenced from:
GCC_except_table0 in data.cpp.o
"typeinfo for curlpp::OptionBase", referenced from:
curlpp::Option<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >::updateMeToOption(curlpp::OptionBase const&) in data.cpp.o
typeinfo for curlpp::Option<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > in data.cpp.o
"typeinfo for curlpp::RuntimeError", referenced from:
GCC_except_table0 in data.cpp.o
typeinfo for curlpp::UnsetOption in data.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)
make[2]: *** [app] Error 1
make[1]: *** [CMakeFiles/app.dir/all] Error 2
make: *** [all] Error 2
I had previously followed the next thread:
Linking curl in a project using CMake
Adding curlcpp to target_link_libraries() in the cmakelists just makes another error appear:
ld: library not found for -lcurlpp
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [app] Error 1
make[1]: *** [CMakeFiles/app.dir/all] Error 2
make: *** [all] Error 2
By the way, I do not understand why curlcpp appears from no where and without the traditional cmakelists notation ${Some_variable}
use curlpp like below(minimum code):
cmake_minimum_required(VERSION 3.14)
project(testCurlPP LANGUAGES CXX)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
include(FindPkgConfig)
pkg_check_modules(CURLPP REQUIRED curlpp)
add_executable(testCurlPP
main.cpp
)
target_link_libraries(testCurlPP
${CURLPP_LDFLAGS}
)
Note: dont forget to building and installing curlpp before using that in projects.
building(take last release) curlpp:
mkdir build
cd build
cmake ..
make -j8
sudo make install
add its location to environment variables:
LD_LIBRARY_PATH=/usr/local/lib
Related
I am trying to build a conan source with dependency, I am getting
Undefined symbols for architecture x86_64:
I am trying to use geolite2pp in a c++ project, But I am getting this error
Here is content of conanfile.py
class AppConan(ConanFile):
settings = "os", "compiler", "build_type", "arch"
requires = "geolite2pp/0.0.1-2561#avantize/stable"
generators = "cmake"
Got error, while running
conan install -s build_type=Release --build=missing
Undefined symbols for architecture x86_64:
"_MMDB_aget_value", referenced from:
GeoLite2PP::DB::get_field(MMDB_lookup_result_s*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::vector<char const*, std::__1::allocator<char const*> > const&) in GeoLite2PP.cpp.o
"_MMDB_close", referenced from:
GeoLite2PP::DB::~DB() in GeoLite2PP.cpp.o
GeoLite2PP::DB::~DB() in GeoLite2PP.cpp.o
"_MMDB_free_entry_data_list", referenced from:
GeoLite2PP::DB::to_json(MMDB_entry_data_list_s*) in GeoLite2PP.cpp.o
"_MMDB_get_entry_data_list", referenced from:
GeoLite2PP::DB::lookup(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in GeoLite2PP.cpp.o
"_MMDB_get_metadata_as_entry_data_list", referenced from:
GeoLite2PP::DB::get_metadata() in GeoLite2PP.cpp.o
"_MMDB_lib_version", referenced from:
GeoLite2PP::DB::get_lib_version_mmdb() const in GeoLite2PP.cpp.o
"_MMDB_lookup_string", referenced from:
GeoLite2PP::DB::lookup_raw(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in GeoLite2PP.cpp.o
"_MMDB_open", referenced from:
GeoLite2PP::DB::DB(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in GeoLite2PP.cpp.o
"_MMDB_strerror", referenced from:
GeoLite2PP::ErrorCategory::message(int) const in GeoLite2PP_error_category.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)
gmake[2]: *** [src-lib/CMakeFiles/geolite2++s.dir/build.make:99: src-lib/libgeolite2++.dylib] Error 1
[ 75%] Built target geolite2++
gmake[1]: *** [CMakeFiles/Makefile2:93: src-lib/CMakeFiles/geolite2++s.dir/all] Error 2
I am a newbie to cmake and I am writing an application for using tesseract. the g++ command line work fine
g++ -O3 -std=c++11 `pkg-config --cflags --libs tesseract opencv` my_first.cpp -o my_first
But I wrote the following CMakeFile.txt and building in Clion and it throws a bunch of linking errors
cmake_minimum_required(VERSION 2.6)
add_compile_options(-std=c++11)
project (my_first)
find_package(PkgConfig REQUIRED)
pkg_check_modules (OPENCV REQUIRED opencv)
link_directories(${OPENCV_LIBRARY_DIRS})
pkg_check_modules (TESSERACT REQUIRED tesseract)
link_directories(${TESSERACT_LIBRARY_DIRS})
add_executable(myfirst my_first.cpp)
The following is the error thrown
/usr/local/Cellar/cmake/3.11.3/bin/cmake --build
/Users/ggovindan/tessaract_ocr/tesseract/experiments/cmake-build-debug --target all -- -j 4
[ 50%] Linking CXX executable myfirst
Undefined symbols for architecture x86_64:
"cv::Mat::deallocate()", referenced from:
cv::Mat::release() in my_first.cpp.o
"cv::String::deallocate()", referenced from:
cv::String::~String() in my_first.cpp.o
cv::String::operator=(cv::String const&) in my_first.cpp.o
"cv::String::allocate(unsigned long)", referenced from:
cv::String::String(std::__1::basic_string<char,
std::__1::char_traits<char>, std::__1::allocator<char> > const&) in
my_first.cpp.o
"cv::imread(cv::String const&, int)", referenced from:
_main in my_first.cpp.o
"cv::fastFree(void*)", referenced from:
cv::Mat::~Mat() in my_first.cpp.o
"tesseract::TessBaseAPI::GetUTF8Text()", referenced from:
_main in my_first.cpp.o
"tesseract::TessBaseAPI::SetPageSegMode(tesseract::PageSegMode)", referenced from:
_main in my_first.cpp.o
"tesseract::TessBaseAPI::Init(char const*, char const*,
tesseract::OcrEngineMode, char**, int, GenericVector<STRING> const*,
GenericVector<STRING> const*, bool)", referenced from:
tesseract::TessBaseAPI::Init(char const*, char const*,
tesseract::OcrEngineMode) in my_first.cpp.o
"tesseract::TessBaseAPI::SetImage(unsigned char const*, int, int, int, int)", referenced from:
_main in my_first.cpp.o
"tesseract::TessBaseAPI::TessBaseAPI()", referenced from:
_main in my_first.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)
make[2]: *** [myfirst] Error 1
make[1]: *** [CMakeFiles/myfirst.dir/all] Error 2
make: *** [all] Error 2
This is what you need to do.Let me know if you face any problems.
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
find_package( PkgConfig REQUIRED)
pkg_search_module( TESSERACT REQUIRED tesseract )
pkg_search_module( LEPTONICA REQUIRED lept )
include_directories( ${TESSERACT_INCLUDE_DIRS} )
include_directories( ${LEPTONICA_INCLUDE_DIRS} )
link_directories( ${TESSERACT_LIBRARY_DIRS} )
link_directories( ${LEPTONICA_LIBRARY_DIRS} )
find_package( OpenCV REQUIRED )
include_directories("myfirst.h")
file(GLOB SOURCES "myfirst.cpp")
add_executable(myfirst ${SOURCES})
target_link_libraries( myfirst ${OpenCV_LIBS} )
target_link_libraries( myfirst ${TESSERACT_LIBRARIES} )
target_link_libraries( myfirst ${LEPTONICA_LIBRARIES} )
#install
install(TARGETS myfirst DESTINATION /usr/local/bin)
I want to enable debug version of libc++ in macOS, so I define _LIBCPP_DEBUG=1 in cxx_build_flags [Debug Version of libC++],
but unable to link debug function of libc++. I guess there is only release version of libc++ in my system, so how can I get the debug version of libc++ in macOS
Undefined symbols for architecture x86_64:
"std::__1::__libcpp_db::__decrementable(void const*) const", referenced from:
void std::__1::__nth_element<std::__1::__debug_less<std::__1::__less<float, float> >&, std::__1::__wrap_iter<float*> >(std::__1::__wrap_iter<float*>, std::__1::__wrap_iter<float*>, std::__1::__wrap_iter<float*>, std::__1::__debug_less<std::__1::__less<float, float> >&)
I think I got this to work!
So the steps I took,
Check your toolchains __config file for _LIBCPP_VERSION's value.
Browse the source repo for the commit where that version was set
From that commit, find the debug.cpp file
Include/compile/link the debug.cpp with your project (and remember to set _LIBCPP_DEBUG=1).
For me the intermediate results for the steps were (with Catalina, XCode Version 11.3.1)
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/__config was at version 8000
Looking at the history at https://github.com/llvm/llvm-project/commits/main?&path[]=libcxx&path[]=include&path[]=__config I found commit https://github.com/llvm/llvm-project/commit/25977548aa5ad7cfe45a17e4ba136abfa4613b96#diff-0a85f740cd20254bc3bb03975c89d93a
The debug.cpp for that commit is at https://github.com/llvm/llvm-project/blob/25977548aa5ad7cfe45a17e4ba136abfa4613b96/libcxx/src/debug.cpp
I try to reactivate this thread without an answer with more details.
I have the same issue. This is very easy to reproduce:
#include <string>
int main()
{
std::string name;
return 0;
}
and then compile with:
clang++ -D_LIBCPP_DEBUG=1 main.cpp
We obtain:
Undefined symbols for architecture x86_64:
"std::__1::__libcpp_db::__insert_c(void*)", referenced from:
void std::__1::__libcpp_db::__insert_c<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >*) in main-7ff3c5.o
"std::__1::__libcpp_db::__erase_c(void*)", referenced from:
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::~basic_string() in main-7ff3c5.o
"std::__1::__c_node::~__c_node()", referenced from:
std::__1::_C_node<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >::~_C_node() in main-7ff3c5.o
"std::__1::__get_db()", referenced from:
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::basic_string() in main-7ff3c5.o
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::~basic_string() in main-7ff3c5.o
"typeinfo for std::__1::__c_node", referenced from:
typeinfo for std::__1::_C_node<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > in main-7ff3c5.o
"vtable for std::__1::__c_node", referenced from:
std::__1::__c_node::__c_node(void*, std::__1::__c_node*) in main-7ff3c5.o
NOTE: a missing vtable usually means the first non-inline virtual member function has no definition.
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
And if I use g++-9 providen by brew (a real g++ not a disguised Apple Clang compiler), it compiles and runs perfectly.
Forgetting to use debug mode of libc++, is it the only solution?
NB: I saw the same question in https://forums.developer.apple.com/thread/99194
and still no answer.
I just downloaded assimp 3.0 library and build the required make files with cmake, then compiled and build the library itself the process was successfull (with little modification to StepFile.h),
my assimp header folder is located in:
/usr/local/include
and my libassimp.a is located in:
/usr/local/lib
however when i specify library and header files in my command line project and try to test my project i get the following error:
Undefined symbols for architecture x86_64:
"Assimp::Importer::Importer()", referenced from:
_main in main.o
"Assimp::Importer::~Importer()", 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)
and when i add -lassimp to Other Linker Flags i get the following errors:
Undefined symbols for architecture x86_64:
"_crc32", referenced from:
_unzReadCurrentFile in libassimp.a(unzip.c.o)
"_get_crc_table", referenced from:
_unzOpenCurrentFile3 in libassimp.a(unzip.c.o)
"_inflate", referenced from:
Assimp::XGLImporter::InternReadFile(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, aiScene*, Assimp::IOSystem*) in libassimp.a(XGLLoader.cpp.o)
Assimp::BlenderImporter::InternReadFile(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, aiScene*, Assimp::IOSystem*) in libassimp.a(BlenderLoader.cpp.o)
Assimp::XFileParser::XFileParser(std::__1::vector<char, std::__1::allocator<char> > const&) in libassimp.a(XFileParser.cpp.o)
_unzReadCurrentFile in libassimp.a(unzip.c.o)
"_inflateEnd", referenced from:
Assimp::XGLImporter::InternReadFile(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, aiScene*, Assimp::IOSystem*) in libassimp.a(XGLLoader.cpp.o)
Assimp::BlenderImporter::InternReadFile(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, aiScene*, Assimp::IOSystem*) in libassimp.a(BlenderLoader.cpp.o)
Assimp::XFileParser::XFileParser(std::__1::vector<char, std::__1::allocator<char> > const&) in libassimp.a(XFileParser.cpp.o)
_unzCloseCurrentFile in libassimp.a(unzip.c.o)
"_inflateInit2_", referenced from:
Assimp::XGLImporter::InternReadFile(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, aiScene*, Assimp::IOSystem*) in libassimp.a(XGLLoader.cpp.o)
Assimp::BlenderImporter::InternReadFile(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, aiScene*, Assimp::IOSystem*) in libassimp.a(BlenderLoader.cpp.o)
Assimp::XFileParser::XFileParser(std::__1::vector<char, std::__1::allocator<char> > const&) in libassimp.a(XFileParser.cpp.o)
_unzOpenCurrentFile3 in libassimp.a(unzip.c.o)
"_inflateReset", referenced from:
Assimp::XFileParser::XFileParser(std::__1::vector<char, std::__1::allocator<char> > const&) in libassimp.a(XFileParser.cpp.o)
"_inflateSetDictionary", referenced from:
Assimp::XFileParser::XFileParser(std::__1::vector<char, std::__1::allocator<char> > const&) in libassimp.a(XFileParser.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)
I had the same issue recently. The actual solution for me was to ensure that the project where I was using the compiled libassimp.a also linked to libz.dylib rather than turn assimp into a .dylib.
i rebuild assimp so that the makefile yields three library files namely libassimp.3.0.255.dylib libassimp.3.dylib libassimp.dylib, i included them in my project and it worked.
I was working on some computer vision code with OpenCV, and wanted to try running OpenCV by compiling the OpenCV tutorial code using CMake. When I tried to compile and run the basic display_image program, it compiled successfully and ran(I added a CMakeLists.txt file and ran cmake . and then make in Terminal. However, when I applied the same procedure to run a few other programs, it didn't work.
I got the following error message
$ cmake .
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/censam/OpenCV/Vision Code/Examples/grabcut
$ make
Linking CXX executable grabcut
Undefined symbols for architecture x86_64:
"cv::imread(std::__1::basic_string<char, std::__1::char_traits<char>, >
std::__1::allocator<char> > const&, int)", referenced from:
_main in grabcut.cpp.o
"cv::imshow(std::__1::basic_string<char, std::__1::char_traits<char>, >
std::__1::allocator<char> > const&, cv::_InputArray const&)", referenced from:
GCApplication::showImage() const in grabcut.cpp.o
"cv::Exception::Exception(int, std::__1::basic_string<char, std::__1::char_traits<char>, >
std::__1::allocator<char> > const&, std::__1::basic_string<char, >
std::__1::char_traits<char>, std::__1::allocator<char> > const&, >
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >
const&, int)", referenced from:
getBinMask(cv::Mat const&, cv::Mat&) in grabcut.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)
make[2]: *** [grabcut] Error 1
make[1]: *** [CMakeFiles/grabcut.dir/all] Error 2
make: *** [all] Error 2
My CMakeLists.txt file is as follows:
cmake_minimum_required(VERSION 2.8)
project( grabcut )
find_package( OpenCV REQUIRED )
add_executable( grabcut grabcut.cpp )
target_link_libraries( grabcut ${OpenCV_LIBS} )
May I know why this happens?I suspect it could be because CMake hasn't linked the required libraries during compiling. When I tried this with XCode, I got the same result, but I prefer to use CMake so that I can port my code over to linux systems more easily.
I found the following link Linking OpenCV 2.3 program in Mac OS X Lion: symbol(s) not found for architecture x86_64 also had the same problem, but the issue doesn't seem to have been resolved.
Any help on how I can get my program to compile and run using CMake in OSX Mavericks will be much appreciated.
Change the compiler from clang to g++-4.2.
A more detailed explain could be find here.