我试图使用Objective c class中的参数将值传递给C ++类。以下是我用来传递值的代码: -
std::string cpp_str([str UTF8String], [str lengthOfBytesUsingEncoding:NSUTF8StringEncoding]);
wrapped.ExampleMethod(cpp_str);
在Xcode中编译时显示以下错误: -
Undefined symbols for architecture i386:
"Test::ExampleMethod(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)", referenced from:
-[ViewController exampleMethodWithString:] in ViewController.ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
请回答我应该怎么做?