找不到C ++库头

时间:2017-05-15 20:53:48

标签: c++ xcode macos header cppunit

我是OS X用户,我最近安装了" cppunit "库使用 brew 。当我尝试编译" test.cpp"文件使用 TestCase.h 标题时会发生错误:

> test.cpp:3:10: fatal error: 'TestCase.h' file not found
>     #include "TestCase.h"

我正在编译这个文件:

TEST.CPP

#include <iostream>

#include "TestCase.h"

using namespace CppUnit;

class EmptyTest : public TestCase

{

};

int main()
{

}

使用此命令:

g++ -Wall -pedantic -std=c++14 test.cpp -o test.x -lcppunit

我还尝试使用 -I 进行编译,给出了库目录的路径,但仍然存在相同的错误。 我所有使用cppunit和brew的朋友都可以简单地包含标题,程序运行正常。

我很感激每一个答案。

1 个答案:

答案 0 :(得分:0)

我已经解决了这个问题。我遇到了Xcode的问题。重新安装工作正常。