Xcode 4 找不到 CPPUNIT

发布于 2024-10-24 08:02:51 字数 788 浏览 1 评论 0原文

我不久前安装了 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 &registry = 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

只涨不跌 2024-10-31 08:02:51

想通了。您需要向项目添加自定义搜索路径:search paths

然后您必须告诉链接器要做什么:< img src="https://i.sstatic.net/mDZkH.png" alt="链接器说明">

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

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文