Cant get gtest working with Xcode 6.2

老子叫甜甜 提交于 2019-12-11 03:49:03

问题


I'm trying to follow the instructions from Here.

The instructions seem very straight forward, but I can't get it to compile. If I download the gtest file from the website, it appears there are header files missing from the include directory which means they don't get into the gtest-framework. the files are the gtest-port-arch.h and everything in the internal/custom folder. I get complier errors that these files are not found.

If I get the source from the svn, all of the files are present in the include dir of the sdk, however, the source folder in the xcode project omits the same files from being added to the project. I have to add them myself then build the frame work. The missing files are then present, but when I build the gtest-framework and add it to the test project, then the Test target's main class does not recognize the TEST calls and I get errors like C++ requires all types to be defined. I am following the steps. I really need to get this framework functioning.

Any help appreciated.


回答1:


I had the same issue and couldn't find out the problem.

Ended up installing the libraries and simply linking them to Xcode, as described in the answer here


I copy the instructions here too. The only difference is that I used /usr/local/include and /usr/local/lib

Moreover, do not forget to set these for your "Tests" target:

Library search paths:  /usr/local/lib
User header search paths: /usr/local/include
other linker flags: -lgtest

Copied:

1. Get the googletest framework

$ wget http://googletest.googlecode.com/files/gtest-1.7.0.zip

2. Unzip and build google test

$ unzip gtest-1.7.0.zip
$ cd gtest-1.7.0
$ ./configure
$ make

3. "Install" the headers and libs on your system.

$ sudo cp -a include/gtest /usr/include
$ sudo cp -a lib/.libs/* /usr/lib/


来源:https://stackoverflow.com/questions/32003624/cant-get-gtest-working-with-xcode-6-2

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!