当我安装天文软件时净化。它需要像 yaml-cpp-0.6.0 这样的最新版本的 yaml 我没有遇到任何错误,标准输出就像
-- The C compiler identification is GNU 7.3.0
-- The CXX compiler identification is GNU 7.3.0
-- Check for working C compiler: /home/luochong/software/gcc7.3/bin/gcc
-- Check for working C compiler: /home/luochong/software/gcc7.3/bin/gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /home/luochong/software/gcc7.3/bin/g++
-- Check for working CXX compiler: /home/luochong/software/gcc7.3/bin/g++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Performing Test FLAG_WEXTRA
-- Performing Test FLAG_WEXTRA - Success
-- Found PythonInterp: /usr/bin/python (found version "2.7.12")
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE
-- Configuring done
-- Generating done
-- Build files have been written to: /home/luochong/Downloads/yaml-cpp-yaml-cpp-0.6.0/build
看起来不错。但是当我在 linux shell 中输入“make”时,它会在构建过程结束时抛出错误,似乎无法通过某些测试。我需要安装一个单独的测试框架吗?
[100%] Linking CXX executable run-tests
CMakeFiles/run-tests.dir/integration/handler_spec_test.cpp.o: In function `YAML::(anonymous namespace)::HandlerSpecTest_Ex2_1_SeqScalars_Test::TestBody()':
handler_spec_test.cpp:(.text+0x9002): undefined reference to `testing::internal::GetWithoutMatchers()'
handler_spec_test.cpp:(.text+0x90b3): undefined reference to `testing::internal::GetWithoutMatchers()'
handler_spec_test.cpp:(.text+0x919a): undefined reference to `testing::internal::GetWithoutMatchers()'
handler_spec_test.cpp:(.text+0x9281): undefined reference to `testing::internal::GetWithoutMatchers()'
handler_spec_test.cpp:(.text+0x9368): undefined reference to `testing::internal::GetWithoutMatchers()'
CMakeFiles/run-tests.dir/integration/handler_spec_test.cpp.o:handler_spec_test.cpp:(.text+0x9419): more undefined references to `testing::internal::GetWithoutMatchers()' follow
CMakeFiles/run-tests.dir/integration/handler_spec_test.cpp.o: In function `testing::internal::FunctionMocker<void (YAML::Mark const&)>::UntypedPerformAction(void const*, void*) const':
handler_spec_test.cpp:(.text._ZNK7testing8internal14FunctionMockerIFvRKN4YAML4MarkEEE20UntypedPerformActionEPKvPv[_ZNK7testing8internal14FunctionMockerIFvRKN4YAML4MarkEEE20UntypedPerformActionEPKvPv]+0x9e): undefined reference to `testing::internal::IllegalDoDefault(char const*, int)'
CMakeFiles/run-tests.dir/integration/handler_spec_test.cpp.o: In function `testing::internal::FunctionMocker<void (YAML::Mark const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned long, YAML::EmitterStyle::value)>::UntypedPerformAction(void const*, void*) const':
handler_spec_test.cpp:(.text._ZNK7testing8internal14FunctionMockerIFvRKN4YAML4MarkERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEmNS2_12EmitterStyle5valueEEE20UntypedPerformActionEPKvPv[_ZNK7testing8internal14FunctionMockerIFvRKN4YAML4MarkERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEmNS2_12EmitterStyle5valueEEE20UntypedPerformActionEPKvPv]+0xda): undefined reference to `testing::internal::IllegalDoDefault(char const*, int)'
CMakeFiles/run-tests.dir/integration/handler_spec_test.cpp.o: In function `testing::internal::FunctionMocker<void (YAML::Mark const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned long, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)>::UntypedPerformAction(void const*, void*) const':
handler_spec_test.cpp:(.text._ZNK7testing8internal14FunctionMockerIFvRKN4YAML4MarkERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEmSD_EE20UntypedPerformActionEPKvPv[_ZNK7testing8internal14FunctionMockerIFvRKN4YAML4MarkERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEmSD_EE20UntypedPerformActionEPKvPv]+0xd2): undefined reference to `testing::internal::IllegalDoDefault(char const*, int)'
CMakeFiles/run-tests.dir/integration/handler_spec_test.cpp.o: In function `testing::internal::FunctionMocker<void (YAML::Mark const&, unsigned long)>::UntypedPerformAction(void const*, void*) const':
handler_spec_test.cpp:(.text._ZNK7testing8internal14FunctionMockerIFvRKN4YAML4MarkEmEE20UntypedPerformActionEPKvPv[_ZNK7testing8internal14FunctionMockerIFvRKN4YAML4MarkEmEE20UntypedPerformActionEPKvPv]+0xb2): undefined reference to `testing::internal::IllegalDoDefault(char const*, int)'
CMakeFiles/run-tests.dir/integration/handler_spec_test.cpp.o: In function `testing::internal::FunctionMocker<void ()>::UntypedPerformAction(void const*, void*) const':
handler_spec_test.cpp:(.text._ZNK7testing8internal14FunctionMockerIFvvEE20UntypedPerformActionEPKvPv[_ZNK7testing8internal14FunctionMockerIFvvEE20UntypedPerformActionEPKvPv]+0x8b): undefined reference to `testing::internal::IllegalDoDefault(char const*, int)'
CMakeFiles/run-tests.dir/integration/handler_spec_test.cpp.o:handler_spec_test.cpp:(.text._ZNK7testing8internal14FunctionMockerIFvRKN4YAML4MarkERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEmSD_EE27UntypedPerformDefaultActionEPvSD_[_ZNK7testing8internal14FunctionMockerIFvRKN4YAML4MarkERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEmSD_EE27UntypedPerformDefaultActionEPvSD_]+0x29c): more undefined references to `testing::internal::IllegalDoDefault(char const*, int)' follow
CMakeFiles/run-tests.dir/integration/handler_spec_test.cpp.o: In function `YAML::MockEventHandler::OnSequenceEnd()':
handler_spec_test.cpp:(.text._ZN4YAML16MockEventHandler13OnSequenceEndEv[_ZN4YAML16MockEventHandler13OnSequenceEndEv]+0x25): undefined reference to `testing::internal::UntypedFunctionMockerBase::UntypedInvokeWith(void*)'
CMakeFiles/run-tests.dir/integration/handler_spec_test.cpp.o: In function `YAML::MockEventHandler::OnMapEnd()':
handler_spec_test.cpp:(.text._ZN4YAML16MockEventHandler8OnMapEndEv[_ZN4YAML16MockEventHandler8OnMapEndEv]+0x25): undefined reference to `testing::internal::UntypedFunctionMockerBase::UntypedInvokeWith(void*)'
CMakeFiles/run-tests.dir/integration/handler_spec_test.cpp.o: In function `YAML::MockEventHandler::OnDocumentEnd()':
handler_spec_test.cpp:(.text._ZN4YAML16MockEventHandler13OnDocumentEndEv[_ZN4YAML16MockEventHandler13OnDocumentEndEv]+0x22): undefined reference to `testing::internal::UntypedFunctionMockerBase::UntypedInvokeWith(void*)'
CMakeFiles/run-tests.dir/integration/handler_spec_test.cpp.o: In function `YAML::MockEventHandler::OnDocumentStart(YAML::Mark const&)':
handler_spec_test.cpp:(.text._ZN4YAML16MockEventHandler15OnDocumentStartERKNS_4MarkE[_ZN4YAML16MockEventHandler15OnDocumentStartERKNS_4MarkE]+0x2b): undefined reference to `testing::internal::UntypedFunctionMockerBase::UntypedInvokeWith(void*)'
CMakeFiles/run-tests.dir/integration/handler_spec_test.cpp.o: In function `YAML::MockEventHandler::OnNull(YAML::Mark const&, unsigned long)':
handler_spec_test.cpp:(.text._ZN4YAML16MockEventHandler6OnNullERKNS_4MarkEm[_ZN4YAML16MockEventHandler6OnNullERKNS_4MarkEm]+0x38): undefined reference to `testing::internal::UntypedFunctionMockerBase::UntypedInvokeWith(void*)'
CMakeFiles/run-tests.dir/integration/handler_spec_test.cpp.o:handler_spec_test.cpp:(.text._ZN4YAML16MockEventHandler7OnAliasERKNS_4MarkEm[_ZN4YAML16MockEventHandler7OnAliasERKNS_4MarkEm]+0x38): more undefined references to `testing::internal::UntypedFunctionMockerBase::UntypedInvokeWith(void*)' follow
CMakeFiles/run-tests.dir/integration/handler_spec_test.cpp.o: In function `testing::internal::MockSpec<void (YAML::Mark const&)>::InternalExpectedAt(char const*, int, char const*, char const*)':
handler_spec_test.cpp:(.text._ZN7testing8internal8MockSpecIFvRKN4YAML4MarkEEE18InternalExpectedAtEPKciS9_S9_[_ZN7testing8internal8MockSpecIFvRKN4YAML4MarkEEE18InternalExpectedAtEPKciS9_S9_]+0x485): undefined reference to `testing::Expectation::Expectation(std::shared_ptr<testing::internal::ExpectationBase> const&)'
CMakeFiles/run-tests.dir/integration/handler_spec_test.cpp.o: In function `testing::internal::MockSpec<void (YAML::Mark const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned long, YAML::EmitterStyle::value)>::InternalExpectedAt(char const*, int, char const*, char const*)':
handler_spec_test.cpp:(.text._ZN7testing8internal8MockSpecIFvRKN4YAML4MarkERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEmNS2_12EmitterStyle5valueEEE18InternalExpectedAtEPKciSJ_SJ_[_ZN7testing8internal8MockSpecIFvRKN4YAML4MarkERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEmNS2_12EmitterStyle5valueEEE18InternalExpectedAtEPKciSJ_SJ_]+0x52c): undefined reference to `testing::Expectation::Expectation(std::shared_ptr<testing::internal::ExpectationBase> const&)'
CMakeFiles/run-tests.dir/integration/handler_spec_test.cpp.o: In function `testing::internal::MockSpec<void ()>::InternalExpectedAt(char const*, int, char const*, char const*)':
handler_spec_test.cpp:(.text._ZN7testing8internal8MockSpecIFvvEE18InternalExpectedAtEPKciS5_S5_[_ZN7testing8internal8MockSpecIFvvEE18InternalExpectedAtEPKciS5_S5_]+0x43d): undefined reference to `testing::Expectation::Expectation(std::shared_ptr<testing::internal::ExpectationBase> const&)'
CMakeFiles/run-tests.dir/integration/handler_spec_test.cpp.o: In function `testing::internal::MockSpec<void (YAML::Mark const&, unsigned long)>::InternalExpectedAt(char const*, int, char const*, char const*)':
handler_spec_test.cpp:(.text._ZN7testing8internal8MockSpecIFvRKN4YAML4MarkEmEE18InternalExpectedAtEPKciS9_S9_[_ZN7testing8internal8MockSpecIFvRKN4YAML4MarkEmEE18InternalExpectedAtEPKciS9_S9_]+0x4be): undefined reference to `testing::Expectation::Expectation(std::shared_ptr<testing::internal::ExpectationBase> const&)'
CMakeFiles/run-tests.dir/integration/handler_spec_test.cpp.o: In function `testing::internal::MockSpec<void (YAML::Mark const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned long, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)>::InternalExpectedAt(char const*, int, char const*, char const*)':
handler_spec_test.cpp:(.text._ZN7testing8internal8MockSpecIFvRKN4YAML4MarkERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEmSD_EE18InternalExpectedAtEPKciSH_SH_[_ZN7testing8internal8MockSpecIFvRKN4YAML4MarkERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEmSD_EE18InternalExpectedAtEPKciSH_SH_]+0x52c): undefined reference to `testing::Expectation::Expectation(std::shared_ptr<testing::internal::ExpectationBase> const&)'
CMakeFiles/run-tests.dir/integration/handler_test.cpp.o: In function `YAML::(anonymous namespace)::HandlerTest_PlainScalarStartingWithQuestionMark_Test::TestBody()':
handler_test.cpp:(.text+0x9f2): undefined reference to `testing::internal::GetWithoutMatchers()'
handler_test.cpp:(.text+0xaa3): undefined reference to `testing::internal::GetWithoutMatchers()'
handler_test.cpp:(.text+0xb8a): undefined reference to `testing::internal::GetWithoutMatchers()'
handler_test.cpp:(.text+0xc71): undefined reference to `testing::internal::GetWithoutMatchers()'
handler_test.cpp:(.text+0xd22): undefined reference to `testing::internal::GetWithoutMatchers()'
CMakeFiles/run-tests.dir/integration/handler_test.cpp.o:handler_test.cpp:(.text+0xd5c): more undefined references to `testing::internal::GetWithoutMatchers()' follow
collect2: error: ld returned 1 exit status
test/CMakeFiles/run-tests.dir/build.make:356: recipe for target 'test/run-tests' failed
make[2]: *** [test/run-tests] Error 1
CMakeFiles/Makefile2:221: recipe for target 'test/CMakeFiles/run-tests.dir/all' failed
make[1]: *** [test/CMakeFiles/run-tests.dir/all] Error 2
Makefile:138: recipe for target 'all' failed
make: *** [all] Error 2
我很笨拙,无法从错误代码中获取任何有用的信息。我需要帮助QAQ
为了向自己证明问题出在哪里,在CMakeLists.txt的第 24 行,暂时将“启用测试”选项更改为关闭并重试:
option(YAML_CPP_BUILD_TESTS "Enable testing" ON)
if(YAML_CPP_BUILD_TESTS) enable_testing() add_subdirectory(test) endif()
请注意,yaml-cpp 使用“ Google Test ”
所以要么在你的路径中有另一个版本的谷歌测试,要么 yaml-cpp 项目没有在它的树中自动构建谷歌测试套件。因此,请确定是否 正在构建https://github.com/jbeder/yaml-cpp/tree/master/test和子组件。