[CMake] Linking CXX executable xxx :undefined reference to `stlp_std::cout'
Chaos Zhang
zcsd2012 at gmail.com
Mon May 16 06:57:14 EDT 2016
Hi all,
I was trying to convert an existed c++ project to CMake. The existed worked
well with makefile, and i have converted similar one successfully. but when
i try to convert this one, some confusing errors occurred, as below:
18:22:10: Running steps for project encryption...
18:22:10: Starting: "/export/opt/cmake-3.2.2/bin/cmake" --build . --target
all
Linking CXX executable dist/Debug_64/GNU-Linux-x86/encryption
CMakeFiles/encryption.dir/encryption.cc.o: In function `main':
/export1/chao/nanos/nano_clean/nano_clean/src/encryption/encryption.cc:33:
undefined reference to `stlp_std::cout'
...
/export1/chao/nanos/nano_clean/nano_clean/lib/STLport/stlport/stl/_string.c:604:
undefined reference to `stlp_std::__stl_throw_out_of_range(char const*)'
...
(more detail at bottom of this mail)
At first i think it can't find iostream, so i include iostream at
/export1/chao/nanos/nano_clean/nano_clean/lib/STLport/stlport/ by using
'INCLUDE_DIRECTORIES', but i did not work. Could you please give me some
advices?
Best regards,
Chao
detail error messages:
18:22:10: Running steps for project encryption...
18:22:10: Starting: "/export/opt/cmake-3.2.2/bin/cmake" --build . --target
all
Linking CXX executable dist/Debug_64/GNU-Linux-x86/encryption
CMakeFiles/encryption.dir/encryption.cc.o: In function `main':
/export1/chao/nanos/nano_clean/nano_clean/src/encryption/encryption.cc:33:
undefined reference to `stlp_std::cout'
/export1/chao/nanos/nano_clean/nano_clean/src/encryption/encryption.cc:39:
undefined reference to `stlp_std::cout'
/export1/chao/nanos/nano_clean/nano_clean/src/encryption/encryption.cc:46:
undefined reference to `stlp_std::cout'
/export1/chao/nanos/nano_clean/nano_clean/src/encryption/encryption.cc:48:
undefined reference to `stlp_std::cout'
/export1/chao/nanos/nano_clean/nano_clean/src/encryption/encryption.cc:54:
undefined reference to `stlp_std::cout'
CMakeFiles/encryption.dir/encryption.cc.o:/export1/chao/nanos/nano_clean/nano_clean/src/encryption/encryption.cc:56:
more undefined references to `stlp_std::cout' follow
CMakeFiles/encryption.dir/encryption.cc.o: In function
`stlp_std::ios_base::_M_check_exception_mask()':
/export1/chao/nanos/nano_clean/nano_clean/lib/STLport/stlport/stl/_ios_base.h:191:
undefined reference to `stlp_std::ios_base::_M_throw_failure()'
CMakeFiles/encryption.dir/encryption.cc.o: In function
`stlp_std::priv::_String_base<char, stlp_std::allocator<char>
>::_M_throw_out_of_range() const':
/export1/chao/nanos/nano_clean/nano_clean/lib/STLport/stlport/stl/_string.c:604:
undefined reference to `stlp_std::__stl_throw_out_of_range(char const*)'
CMakeFiles/encryption.dir/encryption.cc.o: In function
`stlp_std::priv::_String_base<char, stlp_std::allocator<char>
>::_M_throw_length_error() const':
/export1/chao/nanos/nano_clean/nano_clean/lib/STLport/stlport/stl/_string.c:600:
undefined reference to `stlp_std::__stl_throw_length_error(char const*)'
CMakeFiles/encryption.dir/encryption.cc.o: In function `char*
boost::detail::lcast_put_unsigned<stlp_std::char_traits<char>, unsigned
int, char>(unsigned int, char*)':
/export1/chao/nanos/nano_clean/nano_clean/lib/boost/1.49.0/boost/lexical_cast.hpp:561:
undefined reference to `stlp_std::locale::locale()'
/export1/chao/nanos/nano_clean/nano_clean/lib/boost/1.49.0/boost/lexical_cast.hpp:562:
undefined reference to `stlp_std::locale::classic()'
/export1/chao/nanos/nano_clean/nano_clean/lib/boost/1.49.0/boost/lexical_cast.hpp:562:
undefined reference to `stlp_std::locale::operator!=(stlp_std::locale
const&) const'
/export1/chao/nanos/nano_clean/nano_clean/lib/boost/1.49.0/boost/lexical_cast.hpp:617:
undefined reference to `stlp_std::locale::~locale()'
/export1/chao/nanos/nano_clean/nano_clean/lib/boost/1.49.0/boost/lexical_cast.hpp:617:
undefined reference to `stlp_std::locale::~locale()'
CMakeFiles/encryption.dir/encryption.cc.o: In function
`stlp_std::allocator<char>::_M_allocate(unsigned long, unsigned long&)':
/export1/chao/nanos/nano_clean/nano_clean/lib/STLport/stlport/stl/_alloc.h:348:
undefined reference to `stlp_std::__malloc_alloc::allocate(unsigned long)'
CMakeFiles/encryption.dir/encryption.cc.o: In function
`stlp_std::numpunct<char>*
stlp_std::priv::_UseFacet<stlp_std::numpunct<char> >(stlp_std::locale
const&, stlp_std::numpunct<char> const*)':
/export1/chao/nanos/nano_clean/nano_clean/lib/STLport/stlport/stl/_locale.h:349:
undefined reference to `stlp_std::locale::_M_use_facet(stlp_std::locale::id
const&) const'
CMakeFiles/encryption.dir/encryption.cc.o: In function
`stlp_std::locale::id&
stlp_std::priv::_GetFacetId<stlp_std::numpunct<char>
>(stlp_std::numpunct<char> const*)':
/export1/chao/nanos/nano_clean/nano_clean/lib/STLport/stlport/stl/_locale.h:325:
undefined reference to `stlp_std::numpunct<char>::id'
collect2: error: ld returned 1 exit status
gmake[2]: *** [dist/Debug_64/GNU-Linux-x86/encryption] Error 1
gmake[1]: *** [CMakeFiles/encryption.dir/all] Error 2
gmake: *** [all] Error 2
18:22:10: The process "/export/opt/cmake-3.2.2/bin/cmake" exited with code
2.
Error while building/deploying project encryption (kit: kit-chao)
When executing step "Make"
18:22:11: Elapsed time: 00:01.
--
View this message in context: http://cmake.3232098.n2.nabble.com/Linking-CXX-executable-xxx-undefined-reference-to-stlp-std-cout-tp7593473.html
Sent from the CMake mailing list archive at Nabble.com.
More information about the CMake
mailing list