问题描述
我不久前安装了 Xcode 4,我终于开始安装 cppunit.昨晚我尝试在我的一个项目中使用它,但我不断收到 Xcode 找不到 cppunit 文件的错误.例如.未找到词法或预处理器问题cppunit/extensions/TestFactoryRegistry.h"
.
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 ®istry = CppUnit::TestFactoryRegistry::getRegistry();
runner.addTest (registry.makeTest ());
return runner.run ("", false);
}
所以我检查了/usr/local/include 和/usr/local/lib 并且所有的 cppunit 文件都在那里.我安装 cppunit 时也没有错误.我的理解是 Xcode 默认搜索/usr/local/include 和/usr/local/lib .我是否需要向路径变量添加某些内容或更改项目设置才能使其正常工作?
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?
提前致谢,麦迪逊
推荐答案
想通了.您需要为项目添加自定义搜索路径:
Figured it out. You need to add custom search paths to the project:
然后你必须告诉链接器做什么:
And then you have to tell the linker what to do:
这篇关于Xcode 4 找不到 CPPUNIT的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!