C++ linker error in Apache Thrift tutorial - undefined symbols

后端 未结 1 943
[愿得一人]
[愿得一人] 2021-01-21 14:01

I am running through Apache\'s Thrift tutorial: http://wiki.apache.org/thrift/ThriftUsageC%2B%2B My Thrift is version 0.9.1, and I\'m on OS X. I\'ve performed a search for sim

相关标签:
1条回答
  • 2021-01-21 14:36

    I ran into something similar on OSX Mavericks (I believe), this was a while back. Since you're using clang as well I take it you might be on OSX too?

    Anyways, what I ended up doing was compiling on the C++11 standard and using for the stdlib libc++ as opposed to libstdc++. Current versions of clang deal well with both.

    So your compile lines would probably end up looking something like this:

    g++ -std=c++11 -stdlib=libc++ -DHAVE_INTTYPES_H -DHAVE_NETINET_IN_H -Wall -I/usr/local/include/thrift Foo.cpp Foo_server.cpp foo_constants.cpp foo_types.cpp -L/usr/local/lib -lthrift -o foo
    

    I also vaguely recall I had to resort to c++0x on linux and gcc, but these are subject to compiler/version.

    0 讨论(0)
提交回复
热议问题