Reputation: 149
I'm getting started with Google Test for C++. Unfortunately I'm having trouble trying to include the header files. The first line of my little test program sumTest.cpp says
#include "gtest/gtest.h"
while subTest.cpp is in the same directory as gtest . gtest also contains the directory called internal, which contains gtest-internal.h . When I try to compile subTest.cpp from the terminal, it says
g++ sumTest.cpp In file included from sumTest.cpp:1: ./gtest/gtest.h:62:10: fatal error: 'gtest/internal/gtest-internal.h' file not found #include "gtest/internal/gtest-internal.h" ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1 error generated.
So it finds the file gtest/gtest.h but not the file gtest/internal/gtest-internal.h , which seems strange to me.
I'm thankful for every kind of help.
Upvotes: 2
Views: 13731
Reputation: 63765
The line with your error is the first local include statement in gtest.h. The directory that contains gtest is not in your list of include search paths.
gtest/gtest.h
is working only because it's relative to the current file.
You need to add the path that contains the directory gtest
to your list of include search paths.
Upvotes: 1