Click here to Skip to main content
15,891,677 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
i write test functions in c++ (linux) that look like :

#include <gtest/gtest.h>

#include"./ApproximationOfPi.cpp"
//-lgtest -lpthread


Test(ApproximationOfPiTest,computeNumPointsInCircle)
{
ASSERT_EQ(3,computeNumPointsInCircle(1));
ASSERT_EQ(11,computeNumPointsInCircle(2));
ASSERT_EQ(27,computeNumPointsInCircle(3));
}

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 ?
Posted
Updated 22-May-20 3:09am
v5
Comments
Richard MacCutchan 22-May-20 4:31am    
"fatal error: gtest/gtest.h: No such file or directory"

1 solution

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.
 
Share this answer
 
Comments
CPallini 22-May-20 2:20am    
5.

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900