Xcode 4 找不到 CPPUNIT
我不久前安装了 Xcode 4,终于开始安装 cppunit。昨晚我尝试在我的一个项目中使用它,但我不断收到 Xcode 找不到 cppunit 文件的错误。 例如,找不到词法或预处理器问题“cppunit/extensions/TestFactoryRegistry.h”。
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 。我是否需要向路径变量添加某些内容或更改项目设置才能使其正常工作?
提前致谢, 麦迪逊
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);
}
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
想通了。您需要向项目添加自定义搜索路径:
然后您必须告诉链接器要做什么:< img src="https://i.sstatic.net/mDZkH.png" alt="链接器说明">
Figured it out. You need to add custom search paths to the project:
And then you have to tell the linker what to do: