简体   繁体   中英

Unable to add Google Test NuGet package to a Visual Studio Linux C++ project

I have a Linux C++ project in Visual Studio 2017 which contains unit tests, and I'm trying to add the Google test framework to it. I have added the gtest NuGEt package to the project, and in every file that uses this, I have a #include "gtest/gtest.h" . This works fine in a Windows-based unit test project, but in the Linux C++ project (all else being equal as far as I can tell), the NuGet package doesn't seem to be able to work, and when I compile I get the following error :

gtest/gtest.h: No such file or directory.

Does anyone know why this doesn't work?

That's because VS Linux projects are compiled and executed on a connected Linux machine (see Tools / Options / Connection Manager). Which in your case does not have Gtest installed.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM