Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Undefined symbols for architecture x86_64 #26

Closed
jeanbza opened this issue Mar 9, 2015 · 3 comments
Closed

Undefined symbols for architecture x86_64 #26

jeanbza opened this issue Mar 9, 2015 · 3 comments

Comments

@jeanbza
Copy link

jeanbza commented Mar 9, 2015

Running on a mac using gcc-4.9 (also tried and got the same error with the provided xcode c++ compiler), I get this error. This is using the project as a submodule and following the README step by step. Here is my CMakeList.txt and error when I try to make. Any ideas?

cmake_minimum_required(VERSION 2.8)
project (rest_test)

ADD_SUBDIRECTORY(lib/curlcpp)
INCLUDE_DIRECTORIES(${CURLCPP_SOURCE_DIR}/include)

add_executable (rest_test rest_test.cc)
Linking CXX executable rest_test
Undefined symbols for architecture x86_64:
  "curl::curl_exception::traceback", referenced from:
      curl::curl_exception::what() in rest_test.cc.o
      curl::curl_exception::print_traceback() const in rest_test.cc.o
  "curl::curl_exception::curl_exception(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> >)", referenced from:
      curl::curl_easy_exception::curl_easy_exception(CURLcode, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >) in rest_test.cc.o
  "curl::curl_exception::~curl_exception()", referenced from:
      curl::curl_easy_exception::~curl_easy_exception() in rest_test.cc.o
  "curl::curl_easy::perform()", referenced from:
      _main in rest_test.cc.o
  "curl::curl_easy::curl_easy()", referenced from:
      _main in rest_test.cc.o
  "curl::curl_easy::~curl_easy()", referenced from:
      _main in rest_test.cc.o
  "typeinfo for curl::curl_exception", referenced from:
      typeinfo for curl::curl_easy_exception in rest_test.cc.o
  "vtable for curl::curl_exception", referenced from:
      curl::curl_exception::curl_exception(curl::curl_exception const&) in rest_test.cc.o
  NOTE: a missing vtable usually means the first non-inline virtual member function has no definition.
  "_curl_easy_setopt", referenced from:
      void curl::curl_easy::add<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >(curl::curl_pair<CURLoption, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >) in rest_test.cc.o
      void curl::curl_easy::add<long>(curl::curl_pair<CURLoption, long>) in rest_test.cc.o
  "_curl_easy_strerror", referenced from:
      curl::curl_easy_exception::curl_easy_exception(CURLcode, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >) in rest_test.cc.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]: *** [rest_test] Error 1
make[1]: *** [CMakeFiles/rest_test.dir/all] Error 2
make: *** [all] Error 2
@jeanbza
Copy link
Author

jeanbza commented Mar 9, 2015

Additional data point - when I cd into curlcpp, I run cmake . and make and get the following:

jadekler at Jeans-MacBook-Pro in ~/workspace/git-c-rgbmatrix/lib/curlcpp on master*
$ make
Scanning dependencies of target curlcpp
[ 12%] Building CXX object src/CMakeFiles/curlcpp.dir/curl_easy.cpp.o
gcc-4.9: error: unrecognized command line option '-stdlib=libc++'
make[2]: *** [src/CMakeFiles/curlcpp.dir/curl_easy.cpp.o] Error 1
make[1]: *** [src/CMakeFiles/curlcpp.dir/all] Error 2
make: *** [all] Error 2

@JosephP91
Copy link
Owner

@jadekler it's strange. I have g++49 too and I can't reproduce this error

@susnux
Copy link
Contributor

susnux commented Apr 12, 2015

The first one is using clang

clang: error: linker ...

But the second one is using gcc, the problem here is that cmake put a clan command (-stdlib) into gcc makefile.
Try with a clean copy of curlcpp something like:

CC=gcc CXX=g++ cmake .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants