linking error when building Google test on mac (commandline)

前端 未结 3 1733
梦谈多话
梦谈多话 2020-12-15 07:53

I am currently trying to build some test code that uses Google C++ Test framework but I keep getting an error stating

ld: warning: in /usr/local/lib/libgtest.dylib,

3条回答
  •  天命终不由人
    2020-12-15 08:54

    Compile gtest and your project with the same compiler (-flags).

    If you compiled gtest with Apple g++ and meanwhile installed gcc with e.g. homebrew, linking to gtest will cause this error. This is exactly the reason why Google advices to integrate gtest statically linked in your project, and not to use precompiled binaries.

提交回复
热议问题