I am trying to build CPP Unit 1.12 and getting following link errors. Could any body help me to resolve this:
Undefined first referenced
symbol in file
std::basic_ostream<char,std::char_traits<char> >&std::basic_ostream<char,std::char_traits<char> >::operator<<(int) .libs/CompilerOutputter.o
std::basic_ostream<char,std::char_traits<char> >&std::basic_ostream<char,std::char_traits<char> >::operator<<(double) .libs/StringTools.o
fabs .libs/TestAssert.o
void __Crun::pure_error() .libs/CompilerOutputter.o
std::invalid_argument::~invalid_argument() .libs/Message.o
__iob .libs/BriefTestProgressListener.o
dlsym .libs/UnixDynamicLibraryManager.o
std::out_of_range::~out_of_range() .libs/Test.o
std::basic_string<char,std::char_traits<char>,std::allocator<char> >&std::basic_string<char,std::char_traits<char>,std::allocator<char> >::operator=(const char*) .libs/Message.o
__rwstd::rwse_eofbit_set .libs/BriefTestProgressListener.o
[Hint: static member __rwstd::rwse_eofbit_set must be defined in the program]
void*__Crun::ex_alloc(unsigned) .libs/AdditionalMessage.o
void __Crun::ex_throw(void*,const __Crun::static_type_info*,void(*)(void*)) .libs/AdditionalMessage.o
std::basic_string<char,std::char_traits<char>,std::allocator<char> >&std::basic_string<char,std::char_traits<char>,std::allocator<char> >::operator=(const std::basic_string<char,std::char_traits<char>,std::allocator<char> >&) .libs/AdditionalMessage.o
std::__RTTI__1nDstdJexception_ .libs/DefaultProtector.o
[Hint: static member std::__RTTI__1nDstdJexception_ must be defined in the program]
std::ios_base::failure::~failure() .libs/BriefTestProgressListener.o
std::type_info::~type_info() .libs/TypeInfoHelper.o
mutex_unlock .libs/AdditionalMessage.o
__rwstd::except_msg_string::except_msg_string(unsigned,...) .libs/BriefTestProgressListener.o
std::basic_string<char,std::char_traits<char>,std::allocator<char> >::basic_string(const char*,const std::allocator<char>&) .libs/AdditionalMessage.o
std::invalid_argument::__vtbl .libs/Message.o
[Hint: try checking whether the first non-inlined, non-pure virtual function of class std::invalid_argument is defined]
bool std::type_info::before(const std::type_info&)const .libs/TypeInfoHelper.o
std::basic_string<char,std::char_traits<char>,std::allocator<char> >&std::basic_string<char,std::char_traits<char>,std::allocator<char> >::__sun_append(const std::basic_string<char,std::char_traits<char>,std::allocator<char> >&) .libs/DefaultProtector.o
const char*std::type_info::name()const .libs/TypeInfoHelper.o
std::basic_string<char,std::char_traits<char>,std::allocator<char> >&std::basic_string<char,std::char_traits<char>,std::allocator<char> >::replace(unsigned,unsigned,unsigned,char) .libs/Message.o
std::__RTTI__1nDstdJbad_alloc_ .libs/AdditionalMessage.o
[Hint: static member std::__RTTI__1nDstdJbad_alloc_ must be defined in the program]
std::runtime_error::~runtime_error() .libs/DynamicLibraryManager.o
std::ios_base::failure::failure(const std::basic_string<char,std::char_traits<char>,std::allocator<char> >&) .libs/BriefTestProgressListener.o
void __Crun::ex_chk_unexpected() .libs/DynamicLibraryManager.o
std::basic_string<char,std::char_traits<char>,std::allocator<char> >::__nullref .libs/AdditionalMessage.o
[Hint: static member std::basic_string<char,std::char_traits<char>,std::allocator<char> >::__nullref must be defined in the program]
std::__RTTI__1nDstdMout_of_range_ .libs/Test.o
[Hint: static member std::__RTTI__1nDstdMout_of_range_ must be defined in the program]
std::basic_ostringstream<char,std::char_traits<char>,std::allocator<char> >::~basic_ostringstream() .libs/StringTools.o
const std::type_info&__Crun::get_typeid(void*) .libs/DefaultProtector.o
_Q_qtou .libs/AdditionalMessage.o
_Q_utoq .libs/AdditionalMessage.o
std::ctype<char>::id .libs/TextTestRunner.o
[Hint: static member std::ctype<char>::id must be defined in the program]
std::logic_error::~logic_error() .libs/Message.o
std::basic_ostream<char,std::char_traits<char> >&std::operator<<(std::basic_ostream<char,std::char_traits<char> >&,const char*) .libs/BriefTestProgressListener.o
__rwstd::__string_ref<char,std::char_traits<char>,std::allocator<char> >*std::basic_string<char,std::char_traits<char>,std::allocator<char> >::__getRep(unsigned,unsigned) .libs/AdditionalMessage.o
std::basic_ostringstream<char,std::char_traits<char>,std::allocator<char> >::basic_ostringstream(int) .libs/StringTools.o
std::basic_ostream<char,std::char_traits<char> >&std::basic_ostream<char,std::char_traits<char> >::flush() .libs/BriefTestProgressListener.o
__assert .libs/TestFactoryRegistry.o
std::basic_string<char,std::char_traits<char>,std::allocator<char> >std::basic_ostringstream<char,std::char_traits<char>,std::allocator<char> >::str()const .libs/StringTools.o
std::runtime_error::~runtime_error #Nvariant 1() .libs/DynamicLibraryManager.o
_Q_mul .libs/AdditionalMessage.o
dlopen .libs/UnixDynamicLibraryManager.o
fflush .libs/BriefTestProgressListener.o
memchr .libs/TestPath.o
memcpy .libs/AdditionalMessage.o
std::ctype_byname<char>::ctype_byname(const char*,unsigned) .libs/TextTestRunner.o
void*__Crun::ex_get() .libs/DefaultProtector.o
std::__RTTI__1nDstdIios_baseHfailure_ .libs/BriefTestProgressListener.o
[Hint: static member std::__RTTI__1nDstdIios_baseHfailure_ must be defined in the program]
__rwstd::facet_imp*std::locale::__make_explicit(const std::locale::id&,bool,int,__rwstd::facet_imp*(*)(int,const char*,unsigned))const .libs/TextTestRunner.o
std::ctype<char>::ctype(const std::ctype_base::mask*,bool,unsigned) .libs/TextTestRunner.o
std::exception::__vtbl .libs/AdditionalMessage.o
[Hint: try checking whether the first non-inlined, non-pure virtual function of class std::exception is defined]
std::basic_string<char,std::char_traits<char>,std::allocator<char> >std::basic_string<char,std::char_traits<char>,std::allocator<char> >::substr(unsigned,unsigned)const .libs/CompilerOutputter.o
std::bad_alloc::__vtbl .libs/AdditionalMessage.o
[Hint: try checking whether the first non-inlined, non-pure virtual function of class std::bad_alloc is defined]
std::ios_base::__sync_with_stdio .libs/BriefTestProgressListener.o
[Hint: static member std::ios_base::__sync_with_stdio must be defined in the program]
sprintf .libs/TestAssert.o
std::cerr .libs/BriefTestProgressListener.o
[Hint: static member std::cerr must be defined in the program]
std::cout .libs/BriefTestProgressListener.o
[Hint: static member std::cout must be defined in the program]
void __Crun::ex_rethrow_q() .libs/AdditionalMessage.o
dlclose .libs/UnixDynamicLibraryManager.o
bool std::type_info::operator==(const std::type_info&)const .libs/TypeInfoHelper.o
std::basic_ostream<char,std::char_traits<char> >&std::operator<<(std::basic_ostream<char,std::char_traits<char> >&,char) .libs/CompilerOutputter.o
bool std::type_info::operator!=(const std::type_info&)const .libs/TypeInfoHelper.o
std::basic_string<char,std::char_traits<char>,std::allocator<char> >std::basic_string<char,std::char_traits<char>,std::allocator<char> >::__sun_concat(const std::basic_string<char,std::char_traits<char>,std::allocator<char> >&)const .libs/Asserter.o
std::out_of_range::__vtbl .libs/Test.o
[Hint: try checking whether the first non-inlined, non-pure virtual function of class std::out_of_range is defined]
int std::basic_string<char,std::char_traits<char>,std::allocator<char> >::compare(unsigned,unsigned,const char*,unsigned)const .libs/Message.o
std::basic_string<char,std::char_traits<char>,std::allocator<char> >std::basic_string<char,std::char_traits<char>,std::allocator<char> >::__sun_concat(const char*)const .libs/DynamicLibraryManagerException.o
mutex_lock .libs/AdditionalMessage.o
void std::basic_string<char,std::char_traits<char>,std::allocator<char> >::__clone() .libs/CompilerOutputter.o
std::basic_string<char,std::char_traits<char>,std::allocator<char> >&std::basic_string<char,std::char_traits<char>,std::allocator<char> >::__sun_append(const char*) .libs/Message.o
void __Crun::register_exit_code(void(*)()extern"C") .libs/TestFactoryRegistry.o
bool __Crun::ex_skip() .libs/AdditionalMessage.o
std::__RTTI__1nDstdQinvalid_argument_ .libs/Message.o
[Hint: static member std::__RTTI__1nDstdQinvalid_argument_ must be defined in the program]
mutex_destroy .libs/AdditionalMessage.o
void __Crun::ex_clean() .libs/AdditionalMessage.o
void __Crun::ex_rethrow() .libs/AdditionalMessage.o
std::logic_error::~logic_error #Nvariant 1() .libs/Message.o
__rwstd::rwse_badbit_set .libs/BriefTestProgressListener.o
[Hint: static member __rwstd::rwse_badbit_set must be defined in the program]
void*operator new(unsigned) .libs/AdditionalMessage.o
std::cin .libs/TextTestRunner.o
[Hint: static member std::cin must be defined in the program]
void operator delete(void*) .libs/AdditionalMessage.o
__rwstd::rwse_failbit_set .libs/BriefTestProgressListener.o
[Hint: static member __rwstd::rwse_failbit_set must be defined in the program]
ld: fatal: Symbol referencing errors. No output written to .libs/libcppunit-1.12.so.0.0.0
*** Error code 1
make: Fatal error: Command failed for target `libcppunit.la'
Current working directory /home/kadurr/CPPUNIT/cppunit-1.12.0/src/cppunit
*** Error code 1
make: Fatal error: Command failed for target `all-recursive'
Current working directory /home/kadurr/CPPUNIT/cppunit-1.12.0/src
*** Error code 1
make: Fatal error: Command failed for target `all-recursive'
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thank you! This solved the link problem. I added "-lm" to LDFLAGS.
BTW, I tried to build "cppunit-1.12.1" on OpenSolaris 2008/05,
and found out that I have to add the following line to the
header file "include/cppunit/portability/FloatingPoint.h":
#include <ieeefp.h>
Can somebody add it to the sources?
Thanks,
Nik
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
I am trying to build CPP Unit 1.12 and getting following link errors. Could any body help me to resolve this:
Undefined first referenced
symbol in file
std::basic_ostream<char,std::char_traits<char> >&std::basic_ostream<char,std::char_traits<char> >::operator<<(int) .libs/CompilerOutputter.o
std::basic_ostream<char,std::char_traits<char> >&std::basic_ostream<char,std::char_traits<char> >::operator<<(double) .libs/StringTools.o
fabs .libs/TestAssert.o
void __Crun::pure_error() .libs/CompilerOutputter.o
std::invalid_argument::~invalid_argument() .libs/Message.o
__iob .libs/BriefTestProgressListener.o
dlsym .libs/UnixDynamicLibraryManager.o
std::out_of_range::~out_of_range() .libs/Test.o
std::basic_string<char,std::char_traits<char>,std::allocator<char> >&std::basic_string<char,std::char_traits<char>,std::allocator<char> >::operator=(const char*) .libs/Message.o
__rwstd::rwse_eofbit_set .libs/BriefTestProgressListener.o
[Hint: static member __rwstd::rwse_eofbit_set must be defined in the program]
void*__Crun::ex_alloc(unsigned) .libs/AdditionalMessage.o
void __Crun::ex_throw(void*,const __Crun::static_type_info*,void(*)(void*)) .libs/AdditionalMessage.o
std::basic_string<char,std::char_traits<char>,std::allocator<char> >&std::basic_string<char,std::char_traits<char>,std::allocator<char> >::operator=(const std::basic_string<char,std::char_traits<char>,std::allocator<char> >&) .libs/AdditionalMessage.o
std::__RTTI__1nDstdJexception_ .libs/DefaultProtector.o
[Hint: static member std::__RTTI__1nDstdJexception_ must be defined in the program]
std::ios_base::failure::~failure() .libs/BriefTestProgressListener.o
std::type_info::~type_info() .libs/TypeInfoHelper.o
mutex_unlock .libs/AdditionalMessage.o
__rwstd::except_msg_string::except_msg_string(unsigned,...) .libs/BriefTestProgressListener.o
std::basic_string<char,std::char_traits<char>,std::allocator<char> >::basic_string(const char*,const std::allocator<char>&) .libs/AdditionalMessage.o
std::invalid_argument::__vtbl .libs/Message.o
[Hint: try checking whether the first non-inlined, non-pure virtual function of class std::invalid_argument is defined]
bool std::type_info::before(const std::type_info&)const .libs/TypeInfoHelper.o
std::basic_string<char,std::char_traits<char>,std::allocator<char> >&std::basic_string<char,std::char_traits<char>,std::allocator<char> >::__sun_append(const std::basic_string<char,std::char_traits<char>,std::allocator<char> >&) .libs/DefaultProtector.o
const char*std::type_info::name()const .libs/TypeInfoHelper.o
std::basic_string<char,std::char_traits<char>,std::allocator<char> >&std::basic_string<char,std::char_traits<char>,std::allocator<char> >::replace(unsigned,unsigned,unsigned,char) .libs/Message.o
std::__RTTI__1nDstdJbad_alloc_ .libs/AdditionalMessage.o
[Hint: static member std::__RTTI__1nDstdJbad_alloc_ must be defined in the program]
std::runtime_error::~runtime_error() .libs/DynamicLibraryManager.o
std::ios_base::failure::failure(const std::basic_string<char,std::char_traits<char>,std::allocator<char> >&) .libs/BriefTestProgressListener.o
void __Crun::ex_chk_unexpected() .libs/DynamicLibraryManager.o
std::basic_string<char,std::char_traits<char>,std::allocator<char> >::__nullref .libs/AdditionalMessage.o
[Hint: static member std::basic_string<char,std::char_traits<char>,std::allocator<char> >::__nullref must be defined in the program]
std::__RTTI__1nDstdMout_of_range_ .libs/Test.o
[Hint: static member std::__RTTI__1nDstdMout_of_range_ must be defined in the program]
std::basic_ostringstream<char,std::char_traits<char>,std::allocator<char> >::~basic_ostringstream() .libs/StringTools.o
const std::type_info&__Crun::get_typeid(void*) .libs/DefaultProtector.o
_Q_qtou .libs/AdditionalMessage.o
_Q_utoq .libs/AdditionalMessage.o
std::ctype<char>::id .libs/TextTestRunner.o
[Hint: static member std::ctype<char>::id must be defined in the program]
std::logic_error::~logic_error() .libs/Message.o
std::basic_ostream<char,std::char_traits<char> >&std::operator<<(std::basic_ostream<char,std::char_traits<char> >&,const char*) .libs/BriefTestProgressListener.o
__rwstd::__string_ref<char,std::char_traits<char>,std::allocator<char> >*std::basic_string<char,std::char_traits<char>,std::allocator<char> >::__getRep(unsigned,unsigned) .libs/AdditionalMessage.o
std::basic_ostringstream<char,std::char_traits<char>,std::allocator<char> >::basic_ostringstream(int) .libs/StringTools.o
std::basic_ostream<char,std::char_traits<char> >&std::basic_ostream<char,std::char_traits<char> >::flush() .libs/BriefTestProgressListener.o
__assert .libs/TestFactoryRegistry.o
std::basic_string<char,std::char_traits<char>,std::allocator<char> >std::basic_ostringstream<char,std::char_traits<char>,std::allocator<char> >::str()const .libs/StringTools.o
std::runtime_error::~runtime_error #Nvariant 1() .libs/DynamicLibraryManager.o
_Q_mul .libs/AdditionalMessage.o
dlopen .libs/UnixDynamicLibraryManager.o
fflush .libs/BriefTestProgressListener.o
memchr .libs/TestPath.o
memcpy .libs/AdditionalMessage.o
std::ctype_byname<char>::ctype_byname(const char*,unsigned) .libs/TextTestRunner.o
void*__Crun::ex_get() .libs/DefaultProtector.o
std::__RTTI__1nDstdIios_baseHfailure_ .libs/BriefTestProgressListener.o
[Hint: static member std::__RTTI__1nDstdIios_baseHfailure_ must be defined in the program]
__rwstd::facet_imp*std::locale::__make_explicit(const std::locale::id&,bool,int,__rwstd::facet_imp*(*)(int,const char*,unsigned))const .libs/TextTestRunner.o
std::ctype<char>::ctype(const std::ctype_base::mask*,bool,unsigned) .libs/TextTestRunner.o
std::exception::__vtbl .libs/AdditionalMessage.o
[Hint: try checking whether the first non-inlined, non-pure virtual function of class std::exception is defined]
std::basic_string<char,std::char_traits<char>,std::allocator<char> >std::basic_string<char,std::char_traits<char>,std::allocator<char> >::substr(unsigned,unsigned)const .libs/CompilerOutputter.o
std::bad_alloc::__vtbl .libs/AdditionalMessage.o
[Hint: try checking whether the first non-inlined, non-pure virtual function of class std::bad_alloc is defined]
std::ios_base::__sync_with_stdio .libs/BriefTestProgressListener.o
[Hint: static member std::ios_base::__sync_with_stdio must be defined in the program]
sprintf .libs/TestAssert.o
std::cerr .libs/BriefTestProgressListener.o
[Hint: static member std::cerr must be defined in the program]
std::cout .libs/BriefTestProgressListener.o
[Hint: static member std::cout must be defined in the program]
void __Crun::ex_rethrow_q() .libs/AdditionalMessage.o
dlclose .libs/UnixDynamicLibraryManager.o
bool std::type_info::operator==(const std::type_info&)const .libs/TypeInfoHelper.o
std::basic_ostream<char,std::char_traits<char> >&std::operator<<(std::basic_ostream<char,std::char_traits<char> >&,char) .libs/CompilerOutputter.o
bool std::type_info::operator!=(const std::type_info&)const .libs/TypeInfoHelper.o
std::basic_string<char,std::char_traits<char>,std::allocator<char> >std::basic_string<char,std::char_traits<char>,std::allocator<char> >::__sun_concat(const std::basic_string<char,std::char_traits<char>,std::allocator<char> >&)const .libs/Asserter.o
std::out_of_range::__vtbl .libs/Test.o
[Hint: try checking whether the first non-inlined, non-pure virtual function of class std::out_of_range is defined]
int std::basic_string<char,std::char_traits<char>,std::allocator<char> >::compare(unsigned,unsigned,const char*,unsigned)const .libs/Message.o
std::basic_string<char,std::char_traits<char>,std::allocator<char> >std::basic_string<char,std::char_traits<char>,std::allocator<char> >::__sun_concat(const char*)const .libs/DynamicLibraryManagerException.o
mutex_lock .libs/AdditionalMessage.o
void std::basic_string<char,std::char_traits<char>,std::allocator<char> >::__clone() .libs/CompilerOutputter.o
std::basic_string<char,std::char_traits<char>,std::allocator<char> >&std::basic_string<char,std::char_traits<char>,std::allocator<char> >::__sun_append(const char*) .libs/Message.o
void __Crun::register_exit_code(void(*)()extern"C") .libs/TestFactoryRegistry.o
bool __Crun::ex_skip() .libs/AdditionalMessage.o
std::__RTTI__1nDstdQinvalid_argument_ .libs/Message.o
[Hint: static member std::__RTTI__1nDstdQinvalid_argument_ must be defined in the program]
mutex_destroy .libs/AdditionalMessage.o
void __Crun::ex_clean() .libs/AdditionalMessage.o
void __Crun::ex_rethrow() .libs/AdditionalMessage.o
std::logic_error::~logic_error #Nvariant 1() .libs/Message.o
__rwstd::rwse_badbit_set .libs/BriefTestProgressListener.o
[Hint: static member __rwstd::rwse_badbit_set must be defined in the program]
void*operator new(unsigned) .libs/AdditionalMessage.o
std::cin .libs/TextTestRunner.o
[Hint: static member std::cin must be defined in the program]
void operator delete(void*) .libs/AdditionalMessage.o
__rwstd::rwse_failbit_set .libs/BriefTestProgressListener.o
[Hint: static member __rwstd::rwse_failbit_set must be defined in the program]
ld: fatal: Symbol referencing errors. No output written to .libs/libcppunit-1.12.so.0.0.0
*** Error code 1
make: Fatal error: Command failed for target `libcppunit.la'
Current working directory /home/kadurr/CPPUNIT/cppunit-1.12.0/src/cppunit
*** Error code 1
make: Fatal error: Command failed for target `all-recursive'
Current working directory /home/kadurr/CPPUNIT/cppunit-1.12.0/src
*** Error code 1
make: Fatal error: Command failed for target `all-recursive'
I had similar problems on Solaris 8 + Forte 6.2 - I added "-lm" to src/cppunit/Makfile.in
Line 308
-release $(LT_RELEASE) @LIBADD_DL@ -lm
This resolved the undefined symbol fabs
I had previously used to patch for the Debian pkg to add the @LIBADD_DL@ (among other things)
Thank you! This solved the link problem. I added "-lm" to LDFLAGS.
BTW, I tried to build "cppunit-1.12.1" on OpenSolaris 2008/05,
and found out that I have to add the following line to the
header file "include/cppunit/portability/FloatingPoint.h":
#include <ieeefp.h>
Can somebody add it to the sources?
Thanks,
Nik