Specify external library for linux from Visual Studio 2017

≡放荡痞女 提交于 2020-01-05 09:06:50

问题


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


回答1:


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".




回答2:


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



来源:https://stackoverflow.com/questions/45815860/specify-external-library-for-linux-from-visual-studio-2017

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!