hiroyuki tanaka
hiroyuki tanaka

Reputation: 101

fatal error: string.h: No such file or directory

In my environment, I couldn't include <cstring>. My g++ version is 4.9.3 (Homebrew gcc49 4.9.3).

The error is:

 - /usr/local/Cellar/gcc49/4.9.3/include/c++/4.9.3/cstring:42:20: fatal
   error: string.h: No such file or directory
  "#include string.h"

But, in another environment (g++ 4.8.4[Ubuntu 4.8.4-2ubuntu1~14.04.3]), I can include <cstring> and run.

What's the problem and how do I solve it?

[P.S.] Maybe, I misunderstood about the problem. I tried to run my previous code, but got an error like this:

    /usr/local/Cellar/gcc49/4.9.3/include/c++/4.9.3/cassert:43:20: fatal error: assert.h: No such file or directory
 #include <assert.h>

Then, I can't run my code. It is a g++'s problem.

I checked this article, but this procedure is not working. I already installed xcode-select (commmad line tool) and I uninstalled xcode-select and reinstalled xcode-select, but it's not working.

Building C++ not working in OSX 10.9

Upvotes: 7

Views: 14118

Answers (1)

Tim Givois
Tim Givois

Reputation: 2014

Reinstalling the heaaders fixed my issue:

open /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg

Upvotes: 1

Related Questions