Xcode 4 can't find CPPUNIT
I installed Xcode 4开发者_如何学C 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 ®istry = 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
Figured it out. You need to add custom search paths to the project:
And then you have to tell the linker what to do:
精彩评论