Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/unit-testing/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Unit testing Googletest/gtets:致命错误:gtest.h:没有这样的文件或目录_Unit Testing_Testing_Googletest_Googlemock - Fatal编程技术网

Unit testing Googletest/gtets:致命错误:gtest.h:没有这样的文件或目录

Unit testing Googletest/gtets:致命错误:gtest.h:没有这样的文件或目录,unit-testing,testing,googletest,googlemock,Unit Testing,Testing,Googletest,Googlemock,我已经从源代码构建了gtest。我创建了静态库。但当我运行测试时,给出的错误是“致命错误:gtest.h:没有这样的文件或目录”。我已经包括了路径。gtest.h存在于include/gtest文件夹中。我不知道为什么会出现这个错误。你能帮我吗?你如何编译你的代码?g++-I/./external/include test.cpp-o tests-L../external/lib-lgtest-lgtest\u main-lpthreadgtest.h在/../external/include中

我已经从源代码构建了gtest。我创建了静态库。但当我运行测试时,给出的错误是“致命错误:gtest.h:没有这样的文件或目录”。我已经包括了路径。gtest.h存在于include/gtest文件夹中。我不知道为什么会出现这个错误。你能帮我吗?

你如何编译你的代码?g++-I/./external/include test.cpp-o tests-L../external/lib-lgtest-lgtest\u main-lpthread
gtest.h
/../external/include
中不存在。它存在于
/../external/include/gtest
中。因此,使用
-I/./external/include/gtest进行编译,或者将include更改为
#include
,这是更常见的选项。您可能还需要更新库路径(
-L
选项),如果编译后您会得到“未解析的引用…”链接器错误显示您是否编译了代码?g++-I/./external/include test.cpp-o tests-L../external/lib-lgtest-lgtest_main-lpthread
gtest.h
/../external/include
中不存在。它存在于
/../external/include/gtest
中。因此,使用
-I/./external/include/gtest进行编译,或者将include更改为
#include
,这是更常见的选项。如果编译后出现“未解析引用…”链接器错误,则可能还需要更新库路径(
-L
选项)