Search code examples
c++clang++googlemock

GMOCK Clang pesky error "/usr/include/limits.h:123:16: fatal error: 'limits.h' file not found"


Using Linux OS for C++ development with GMOCK framework. I have the following code.

#include <stdint.h>
#include <string>
#include "gmock/gmock.h"
#include "dispat_tasks.hh"

namespace testing {

namespace internal {
    GTEST_API_ string JoinAsTuple(const Strings& fields);
}

namespace DispatTasksTestNS {
using ::testing::Invoke;

// Fixture
class DispatTasksTest : public ::testing::Test {
 public:
    DispatTasksTest() {}
    ~DispatTasksTest() {}
    dispat_tasks SMD;
};
}  // testing NS
}

When I execute the clang syntax checking, I get the flowing error.

/usr/include/limits.h:123:16: fatal error: 'limits.h' file not found

The content of the line 123 is:

# include_next <limits.h>

Any way to resolve the error above?


Solution

  • sudo apt-get install libc++1
    

    and

    sudo apt-get install libc++-dev
    

    fixed my issue