Xcode 4 can't find CPPUNIT

六月ゝ 毕业季﹏ 提交于 2019-12-11 10:20:51

问题


I installed Xcode 4 awhile ago and I finally got around to getting cppunit installed. I tried using it in one of my projects last night and I keep getting errors that Xcode cannot find cppunit files. E.g. Lexical or Preprocessor Issue 'cppunit/extensions/TestFactoryRegistry.h' not found.

main.cpp

#include <iostream>
#include "exception.h"
#include "dataStruct.h"
#include <cppunit/extensions/TestFactoryRegistry.h>
#include <cppunit/ui/text/TestRunner.h>

int main ()
{
    CppUnit::TextUi::TestRunner runner;
    CppUnit::TestFactoryRegistry &registry = CppUnit::TestFactoryRegistry::getRegistry();

    runner.addTest (registry.makeTest ());

    return runner.run ("", false);
}

So I checked /usr/local/include and /usr/local/lib and all the cppunit files are there. There were no errors when I installed cppunit either. It is my understanding that Xcode searches /usr/local/include and /usr/local/lib by default. Do I need to add something to a path variable or change a project setting to get it to work?

Thanks in Advance, Madison


回答1:


Figured it out. You need to add custom search paths to the project:

And then you have to tell the linker what to do:



来源:https://stackoverflow.com/questions/5363012/xcode-4-cant-find-cppunit

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