golang的cgo支持调用C++的方法

sohoer2003 ·
cplus.cpp ``` #include <iostream> #include "liupeng.hpp" #include <string> #include <vector> void A::test() { std::string s; std::vector<int> vec; vec.push_back(1); std::cout << "this is class a.test" << std::endl; } void B::test() { std::cout << "this is class b.test" << std::endl; } ``` 这样在go build的时候,就会报错: ``` controllers/libc_test2.a(liupeng.o): In function `A::test()': :(.text+0x24): undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string()' .cpp:(.text+0x7e): undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string()' .cpp:(.text+0xb0): undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string()' ``` 怎么解决,非常感谢
#1