GoogleTest CMake doesn't recognize TEST_F: Like it's not recognizing GTest something

后端 未结 1 891
耶瑟儿~
耶瑟儿~ 2021-01-23 10:34

OK, I admit it, this is a unique case. When we build our application we are using make, so I\'ve included my tests in a test folder under src. Then at the same level as our re

相关标签:
1条回答
  • 2021-01-23 10:41

    As πάντα ῥεῖ pointed out, I hadn't actually tried to build the code. When I did I first received a linker error for pthread, so we added the following line the the CMakeLists.txt file:

    target_link_libraries(OnePrint pthread)
    

    Then I tried again to build and received these errors:

    /home/user/gtest-1.7.0/lib/.libs/libgtest.so: undefined reference to `pthread_key_create'
    /home/user/gtest-1.7.0/lib/.libs/libgtest.so: undefined reference to `pthread_getspecific'
    /home/user/gtest-1.7.0/lib/.libs/libgtest.so: undefined reference to `pthread_key_delete'
    /home/user/gtest-1.7.0/lib/.libs/libgtest.so: undefined reference to `pthread_setspecific'
    collect2: error: ld returned 1 exit status
    

    So, I ran a search on these errors and found this question.

    The answer that worked for me was here.

    0 讨论(0)
提交回复
热议问题