问题描述
我试图为我的c ++项目设置google测试框架,遵循此在xcode 7.0我得到了最后一步Build和Go,但在网上搜索后,我无法让我的测试项目运行。编译器似乎找不到它需要的头。 main.cpp:9:10:'gtest / gtest.h'文件未找到。来源是:
I'm trying to setup google testing framework for my c++ project following this guide in xcode 7.0 I got to the last step Build and Go but after hours of searching online I can't get my test project to run. The compiler does not seem to find the headers it needs. main.cpp:9:10: 'gtest/gtest.h' file not found. The source is:
#include "gtest/gtest.h"
#include "calc.hpp"
int main(int argc, const char * argv[]) {
return 0;
}
我也尝试过
#include< gtest / gtest.h> ;
结果相同。
I also tried #include <gtest/gtest.h>With same result.
推荐答案
有时,Xcode无法在框架中找到头文件。
Sometimes, Xcode cannot find header files in framework. You need additional steps to make it work.
-
在构建设置中,填写框架
In build settings, complete Framework Search Paths with the path to your framework, which is gtest.framework.
添加框架路径并添加到用户标题搜索路径
Add the framework path and to User Header Search Paths.
如果Xcode找不到gtest / internal / gtest-port-arch.h,您可以在源文件夹googletest / googletest / include。
If Xcode cannot find "gtest/internal/gtest-port-arch.h", you can find it in source folder "googletest/googletest/include". Add it to User Header Search Paths.
在这些步骤之后,gtest应该在Xcode 7.0。
After these steps, gtest should work in Xcode 7.0.
这篇关于gtest.h文件未找到googletest xcode 7.0的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!