Specify external library for linux from Visual Stu

2019-08-05 08:05发布

I'm developing linux(ubuntu) c++ project from Visual Studio 2017. I want to integrate googletest into my code. I have installed googletest and run test example according following tutorial. Everything works fine when I run it from bash terminal using cmake.

Now I need to run it using VS. For that I need to specify path to /usr/lib/libgtest.a from VS. I added /usr/lib into Linker->General->Additional Library Directories and added libgtest.a into Linker->Input->Additional Dependencies. But compiler still cannot link the library:

g++: error: libgtest.a: No such file or directory

2条回答
可以哭但决不认输i
2楼-- · 2019-08-05 08:33

Try Configuration Properties -> Linker->Input->Library Dependencies with "gtest". Note: libgtest.a must in standard location so linker can search.

查看更多
放我归山
3楼-- · 2019-08-05 08:37

Try omit "lib" and ".a" from the file name as these portions of the filename seem to be added by the linker itself. In your case you would reference "gtest".

查看更多
登录 后发表回答