GTest installed with Conan: undefined reference

前端 未结 2 1849
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-18 05:26

I tried to use gtest installed through conan, but ended up with an undefined reference linker error. This question is a more or less a follow up to this stackoverflow questi

2条回答
  •  伪装坚强ぢ
    2020-12-18 05:42

    I found an answer to my question:

    The problem is that conan does download/compile gtest binaries by default with libstdc++ even if my compiler (gcc 6.3) uses libstdc++11 by default. Thus there is a mismatch between libstdc++ and libstdc++11.

    To workaround this issue you have to explicit tell conan to compile with libstdc++11:

    conan install .. --build missing -s compiler=gcc -s compiler.version=6.3 -s compiler.libcxx=libstdc++11
    

提交回复
热议问题