Click here to Skip to main content
14,599,401 members
Rate this:
Please Sign up or sign in to vote.
See more:
i write test functions in c++ (linux) that look like :

#include <gtest/gtest.h>

//-lgtest -lpthread


What I have tried:

but it still does't accept the line (#include <gtest gtest.h="">)
when i try to compile it it tells :
ApproximationOfPiTest.cpp:3:25: fatal error: gtest/gtest.h: No such file or directory
#include <gtest gtest.h="">
compilation terminated.

someone know how to fix it pleas ?
Updated 22-May-20 3:09am
Richard MacCutchan 22-May-20 4:31am
"fatal error: gtest/gtest.h: No such file or directory"

1 solution

Rate this:
Please Sign up or sign in to vote.

Solution 1

Make sure the file gtest/gtest.h exists. It has to be in a gtest subdirectory of one of the directories on your include path. That is because you enclosed the name with angle brackets.

Personally, I would change the angle brackets to double quotes. That would allow it to exist in a subdirectory of your source files. If it isn't there then the include path will be searched for it.

This is the difference in using double quotes and angle brackets : using quotes tells the compiler to look first relative to the current directory and if not found then search the include path. The angle brackets tell the compiler to look only in directories on the include path.
CPallini 22-May-20 2:20am

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100