ROS科大讯飞语音错误:编译iat_record_sample出现问题
错误提示:
gcc -g -Wall -I../../include speech_recognizer.o iat_record_sample.o linuxrec.o -o ../../bin/iat_record_sample -L../../libs/x86 -lmsc -lrt -ldl -lpthread -lasound
/usr/bin/ld: skipping incompatible ../../libs/x86/libmsc.so when searching for -lmsc
/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libmsc.so: undefined reference to `typeinfo for std::bad_cast'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libmsc.so: undefined reference to `std::basic_ostringstream, std::allocator >::~basic_ostringstream()'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libmsc.so: undefined reference to `std::string::_Rep::_S_create(unsigned long, unsigned long, std::allocator const&)'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libmsc.so: undefined reference to `std::basic_stringbuf, std::allocator >::pbackfail(int)'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libmsc.so: undefined reference to `vtable for std::basic_stringstream, std::allocator >'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libmsc.so: undefined reference to `__cxa_free_exception'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libmsc.so: undefined reference to `std::basic_stringbuf, std::allocator >::str() const'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libmsc.so: undefined reference to `std::basic_stringbuf, std::allocator >::underflow()'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libmsc.so: undefined reference to `__cxa_begin_catch'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libmsc.so: undefined reference to `std::basic_stringbuf, std::allocator >::overflow(int)'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libmsc.so: undefined reference to `std::string::_Rep::_M_destroy(std::allocator const&)'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libmsc.so: undefined reference to `std::_Rb_tree_rebalance_for_erase(std::_Rb_tree_node_base*, std::_Rb_tree_node_base&)'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libmsc.so: undefined reference to `vtable for std::basic_ostringstream, std::allocator >'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libmsc.so: undefined reference to `std::bad_cast::~bad_cast()'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libmsc.so: undefined reference to `operator delete[](void*)'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libmsc.so: undefined reference to `std::string::reserve(unsigned long)'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libmsc.so: undefined reference to `typeinfo for std::basic_streambuf >'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libmsc.so: undefined reference to `operator new(unsigned long)'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libmsc.so: undefined reference to `VTT for std::basic_stringstream, std::allocator >'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libmsc.so: undefined reference to `std::basic_stringbuf, std::allocator >::showmanyc()'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libmsc.so: undefined reference to `std::basic_streambuf >::seekoff(long, std::_Ios_Seekdir, std::_Ios_Openmode)'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libmsc.so: undefined reference to `std::basic_ostream >& std::operator<< >(std::basic_ostream >&, char const*)'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libmsc.so: undefined reference to `std::string::_M_leak_hard()'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libmsc.so: undefined reference to `std::string::assign(char const*, unsigned long)'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libmsc.so: undefined reference to `std::__throw_length_error(char const*)'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libmsc.so: undefined reference to `std::ios_base::ios_base()'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libmsc.so: undefined reference to `std::string::compare(std::string const&) const'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libmsc.so: undefined reference to `__cxa_guard_release'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libmsc.so: undefined reference to `operator delete(void*)'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libmsc.so: undefined reference to `std::ostream& std::ostream::_M_insert(long)'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libmsc.so: undefined reference to `std::basic_iostream >::~basic_iostream()'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libmsc.so: undefined reference to `std::__throw_bad_cast()'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libmsc.so: undefined reference to `std::string::_M_mutate(unsigned long, unsigned long, unsigned long)'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libmsc.so: undefined reference to `std::numpunct const& std::use_facet >(std::locale const&)'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libmsc.so: undefined reference to `std::basic_string, std::allocator >::basic_string(char const*, std::allocator const&)'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libmsc.so: undefined reference to `vtable for std::basic_stringbuf, std::allocator >'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libmsc.so: undefined reference to `std::basic_streambuf >::uflow()'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libmsc.so: undefined reference to `std::basic_streambuf >::showmanyc()'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libmsc.so: undefined reference to `std::__basic_file::~__basic_file()'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libmsc.so: undefined reference to `__cxa_call_unexpected'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libmsc.so: undefined reference to `std::locale::locale()'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libmsc.so: undefined reference to `operator new[](unsigned long)'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libmsc.so: undefined reference to `std::basic_ostringstream, std::allocator >::basic_ostringstream(std::_Ios_Openmode)'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libmsc.so: undefined reference to `__cxa_pure_virtual'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libmsc.so: undefined reference to `std::basic_ifstream >::~basic_ifstream()'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libmsc.so: undefined reference to `vtable for std::basic_ios >'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libmsc.so: undefined reference to `typeinfo for std::ostream'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libmsc.so: undefined reference to `typeinfo for char const*'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libmsc.so: undefined reference to `typeinfo for float'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libmsc.so: undefined reference to `VTT for std::basic_ifstream >'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libmsc.so: undefined reference to `std::locale::operator==(std::locale const&) const'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libmsc.so: undefined reference to `__cxa_allocate_exception'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libmsc.so: undefined reference to `std::basic_streambuf >::seekpos(std::fpos<__mbstate_t>, std::_Ios_Openmode)'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libmsc.so: undefined reference to `std::__throw_out_of_range(char const*)'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libmsc.so: undefined reference to `__gxx_personality_v0'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libmsc.so: undefined reference to `std::string::_Rep::_S_empty_rep_storage'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libmsc.so: undefined reference to `std::ctype::_M_widen_init() const'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libmsc.so: undefined reference to `std::_Rb_tree_insert_and_rebalance(bool, std::_Rb_tree_node_base*, std::_Rb_tree_node_base*, std::_Rb_tree_node_base&)'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libmsc.so: undefined reference to `std::basic_string, std::allocator >::basic_string(std::string const&, unsigned long, unsigned long)'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libmsc.so: undefined reference to `std::string::replace(unsigned long, unsigned long, char const*, unsigned long)'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libmsc.so: undefined reference to `std::basic_streambuf >::xsgetn(char*, long)'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libmsc.so: undefined reference to `std::string::compare(char const*) const'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libmsc.so: undefined reference to `std::string::rfind(char, unsigned long) const'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libmsc.so: undefined reference to `typeinfo for bool'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libmsc.so: undefined reference to `std::basic_filebuf >::~basic_filebuf()'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libmsc.so: undefined reference to `__cxa_throw'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libmsc.so: undefined reference to `__cxa_guard_abort'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libmsc.so: undefined reference to `std::__throw_bad_alloc()'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libmsc.so: undefined reference to `std::string::append(std::string const&)'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libmsc.so: undefined reference to `std::ios_base::Init::~Init()'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libmsc.so: undefined reference to `std::string::_Rep::_M_dispose(std::allocator const&)'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libmsc.so: undefined reference to `std::basic_streambuf >::xsputn(char const*, long)'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libmsc.so: undefined reference to `std::_Rb_tree_increment(std::_Rb_tree_node_base const*)'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libmsc.so: undefined reference to `std::basic_ostream >& std::__ostream_insert >(std::basic_ostream >&, char const*, long)'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libmsc.so: undefined reference to `typeinfo for std::basic_stringbuf, std::allocator >'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libmsc.so: undefined reference to `std::basic_stringstream, std::allocator >::~basic_stringstream()'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libmsc.so: undefined reference to `std::basic_streambuf >::setbuf(char*, long)'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libmsc.so: undefined reference to `__cxa_end_catch'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libmsc.so: undefined reference to `__cxa_guard_acquire'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libmsc.so: undefined reference to `typeinfo for int'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libmsc.so: undefined reference to `std::basic_filebuf >::open(char const*, std::_Ios_Openmode)'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libmsc.so: undefined reference to `std::basic_ostream >::~basic_ostream()'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libmsc.so: undefined reference to `vtable for std::basic_filebuf >'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libmsc.so: undefined reference to `vtable for std::basic_streambuf >'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libmsc.so: undefined reference to `vtable for __cxxabiv1::__vmi_class_type_info'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libmsc.so: undefined reference to `std::locale::~locale()'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libmsc.so: undefined reference to `vtable for __cxxabiv1::__class_type_info'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libmsc.so: undefined reference to `std::basic_streambuf >::underflow()'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libmsc.so: undefined reference to `std::basic_ios >::fill() const'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libmsc.so: undefined reference to `std::basic_stringbuf, std::allocator >::seekoff(long, std::_Ios_Seekdir, std::_Ios_Openmode)'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libmsc.so: undefined reference to `std::basic_streambuf >::pbackfail(int)'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libmsc.so: undefined reference to `VTT for std::basic_ostringstream, std::allocator >'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libmsc.so: undefined reference to `std::ios_base::Init::Init()'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libmsc.so: undefined reference to `std::ios_base::~ios_base()'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libmsc.so: undefined reference to `std::__detail::_List_node_base::_M_hook(std::__detail::_List_node_base*)'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libmsc.so: undefined reference to `std::ostream& std::ostream::_M_insert(long long)'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libmsc.so: undefined reference to `__dynamic_cast'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libmsc.so: undefined reference to `std::__throw_logic_error(char const*)'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libmsc.so: undefined reference to `std::_Rb_tree_increment(std::_Rb_tree_node_base*)'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libmsc.so: undefined reference to `vtable for std::basic_ifstream >'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libmsc.so: undefined reference to `std::__detail::_List_node_base::_M_transfer(std::__detail::_List_node_base*, std::__detail::_List_node_base*)'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libmsc.so: undefined reference to `std::_Rb_tree_decrement(std::_Rb_tree_node_base*)'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libmsc.so: undefined reference to `std::basic_ios >::init(std::basic_streambuf >*)'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libmsc.so: undefined reference to `std::string::assign(char const*)'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libmsc.so: undefined reference to `std::basic_ifstream >::basic_ifstream(char const*, std::_Ios_Openmode)'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libmsc.so: undefined reference to `std::string::assign(std::string const&)'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libmsc.so: undefined reference to `std::istream::getline(char*, long, char)'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libmsc.so: undefined reference to `std::basic_streambuf >::sync()'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libmsc.so: undefined reference to `std::basic_ios >::rdbuf(std::basic_streambuf >*)'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libmsc.so: undefined reference to `std::basic_filebuf >::close()'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libmsc.so: undefined reference to `std::basic_streambuf >::imbue(std::locale const&)'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libmsc.so: undefined reference to `virtual thunk to std::basic_ostream >::~basic_ostream()'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libmsc.so: undefined reference to `std::basic_stringbuf, std::allocator >::seekpos(std::fpos<__mbstate_t>, std::_Ios_Openmode)'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libmsc.so: undefined reference to `std::__detail::_List_node_base::swap(std::__detail::_List_node_base&, std::__detail::_List_node_base&)'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libmsc.so: undefined reference to `std::ostream& std::ostream::_M_insert(unsigned long)'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libmsc.so: undefined reference to `std::ostream& std::ostream::_M_insert(bool)'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libmsc.so: undefined reference to `std::basic_ios >::clear(std::_Ios_Iostate)'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libmsc.so: undefined reference to `std::basic_filebuf >::basic_filebuf()'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libmsc.so: undefined reference to `std::ostream::operator<<(int)'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libmsc.so: undefined reference to `std::string::resize(unsigned long, char)'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libmsc.so: undefined reference to `__cxa_rethrow'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libmsc.so: undefined reference to `std::basic_stringbuf, std::allocator >::setbuf(char*, long)'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libmsc.so: undefined reference to `std::basic_string, std::allocator >::basic_string(std::string const&)'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libmsc.so: undefined reference to `vtable for __cxxabiv1::__si_class_type_info'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libmsc.so: undefined reference to `std::locale::classic()'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libmsc.so: undefined reference to `std::ostream& std::ostream::_M_insert(double)'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libmsc.so: undefined reference to `std::ostream& std::ostream::_M_insert(void const*)'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libmsc.so: undefined reference to `std::basic_ostream >::~basic_ostream()'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libmsc.so: undefined reference to `virtual thunk to std::basic_ostream >::~basic_ostream()'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libmsc.so: undefined reference to `std::string::append(char const*, unsigned long)'
collect2: error: ld returned 1 exit status
Makefile:25: recipe for target '../../bin/iat_record_sample' failed
make: *** [../../bin/iat_record_sample] Error 1
解决办法:
Makefile有问题:
在第20行的链接库没有指定 -lstdc++
1 #common makefile header
2
3 DIR_INC = ../../include
4 DIR_BIN = ../../bin
5 DIR_LIB = ../../libs
6
7 TARGET = iat_record_sample
8 BIN_TARGET = $(DIR_BIN)/$(TARGET)
9
10 CROSS_COMPILE =
11 CFLAGS = -g -Wall -I$(DIR_INC)
12
13 #可根据实际需要修改,选择所需平台SDK,默认为x64或x86平台。
14 ifdef LINUX64
15 LDFLAGS := -L$(DIR_LIB)/x64
16 else
17 LDFLAGS := -L$(DIR_LIB)/x86
18 endif
19
20 LDFLAGS += -lmsc -lrt -ldl -lpthread -lasound -lstdc++
21
22 OBJECTS := $(patsubst %.c,%.o,$(wildcard *.c))
23
24 $(BIN_TARGET) : $(OBJECTS)
25 $(CROSS_COMPILE)gcc $(CFLAGS) $^ -o $@ $(LDFLAGS)
26
27 %.o : %.c
28 $(CROSS_COMPILE)gcc -c $(CFLAGS) $< -o $@
29 clean:
30 @rm -f *.o $(BIN_TARGET)
31
32 .PHONY:clean
33
34 #common makefile foot