catastrophic error: cannot open source file "stdlib.h" - c++

When compiling a C++ project, I have recently begun to see the following error:
/Library/Developer/CommandLineTools/usr/include/c++/v1/stdlib.h(94): catastrophic error: cannot open source file "stdlib.h"
#include_next <stdlib.h>
This is very strange because the offending line #include_next <stdlib.h> is within the file /Library/Developer/CommandLineTools/usr/include/c++/v1/stdlib.h meaning the file is somehow trying to include itself and failing.
This is a default system file so I don't understand why it should be broken suddenly. And advice would be greatly appreciated.
(Running on macOS Mojave with Intel icpc compiler)

This problem was eventually solved by running the macOS_SDK_headers_for_macOS_10.14.pkg installer located at /Library/Developer/CommandLineTools/Packages

The following command helped me on MacOSX Big Sur: export CPLUS_INCLUDE_PATH=/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/

Related

fatal error: gst/gst.h: No such file or directory #include <gst/gst.h>

I am trying to install GStreamer on windows for writing a C++ code but after installing the files
gstreamer-1.0-devel-msvc-x86_64-1.18.3.msi
and
gstreamer-1.0-msvc-x86_64-1.18.3.msi
from https://gstreamer.freedesktop.org/data/pkg/windows/ and it installs correctly. But when I run the example code basic-tutorial-1.c from gst-docs repo it says
fatal error: gst/gst.h: No such file or directory #include
<gst/gst.h>
I am just getting started using GStreamer so any help would be hugely appreciated! :)
This is what I did:
D:\gst-docs\gst-docs\examples\tutorials> gcc .\basic-tutorial-1.c
.\basic-tutorial-1.c:1:10: fatal error: gst/gst.h: No such file or directory #include <gst/gst.h>
^~~~~~~~~~~ compilation terminated.
The header file is located in the directory: C:\gstreamer\1.0\msvc_x86_64\include\gstreamer-1.0\gst after installing using the installer files.
Edit: I did try other guides on StackOverflow but none seem to work for me.

Why am I getting "no such file or directory" for an opencv file that exists when compiling in Ubuntu?

I'm trying to use the OpenCV library in C++ (VSCode), so I have the statement #include <opencv4/opencv2/imgproc/imgproc.hpp>. When I try to compile using gcc in Ubuntu, however, I get the following error message:
/usr/local/include/opencv4/opencv2/imgproc/imgproc.hpp:48:10: fatal error: opencv2/imgproc.hpp: No such file or directory
#include "opencv2/imgproc.hpp"
I'm fairly new to C++ and Ubuntu in general so I have no idea why this is happening, as I double checked and the file absolutely exists. In fact, even though it's apparently skipped the imgproc folder in finding the file, imgproc.hpp exists both in opencv2 and in the folder imgproc inside opencv2 anyway. How do I get this to work?
Did you try using #include "opencv4/opencv2/imgproc/imgproc.hpp" instead?

openCV setup using Visual Studio Code

I am using Microsoft Visual Studio Code with MinGw for setting up openCV using C++. A simple "Hello World" code executes successfully. But whenever I am trying to include an openCV library the compiler throws an error.
main.cpp:3:10: fatal error: opencv2/opencv.hpp: No such file or directory
3 | #include <opencv2/opencv.hpp>
| ^~~~~~~~~~~~~~~~~~~~
compilation terminated.
I searched for many solution on the internet but unfortunately none worked. Please help me in this regard as I am stuck with this issue for a long time.
c_cpp_properties.json file
launch.json file
task.json file
main.cpp code I am trying to execute

ESP8266WebServer.h, "functional: No such file or directory"

I tried to install library ESP8266WebServer into platformio IDE.
I got this error "functional: No such file or directory". A bit of research of "functional", http://www.cplusplus.com/reference/functional/
In file included from configMode.cpp:13:0:
.pioenvs/uno/ESP8266WebServer/ESP8266WebServer.h:27:22: fatal error: functional: No such file or directory
#include <functional>
^
compilation terminated.
In my case the very same error happened when I was trying to
#include <ESP8266WebServer.h>
in a .c file.
It should be .cpp in order to compile without errors.
I had this problem, but realised I had the wrong board set in the Arduino IDE. If you haven't installed the Arduino core for ESP8266 (https://github.com/esp8266/Arduino#installing-with-boards-manager) do so, then select the correct board from the Arduino IDE Tools menu.
I now have other compiler errors though.

Missing header files on Mac 10.6.8 stop compilation (SNAP software installation)

I'm trying to install Stanford Network Analysis Project.
I work on MacOS 10.6.8. Yesterday I've downloaded the latest compatible version of Xcode (3.1.4) in order to get the GCC package with a C++ compiler.
When I run the "make" command in my Unix Terminal I get hundreds line of errors.
The first one is about a missing file named "poll.h".
make -C snap-core
g++ -c -std=c++98 -Wall -O3 -I/Xcode3.1.4/SDKs/MacOSX10.5.sdk/System/Library/Frameworks/Kernel.framework/Versions/A/Headers/sys -I/Xcode3.1.4/SDKs/MacOSX10.5.sdk/System/Library/Frameworks/Kernel.framework/Versions/A/Headers Snap.cpp -I../glib-core
In file included from Snap.h:8,
from Snap.cpp:4:
../glib-core/base.h:68:24: error: sys/poll.h: No such file or directory
../glib-core/base.h:75:21: error: netdb.h: No such file or directory
../glib-core/base.h:76:25: error: arpa/inet.h: No such file or directory
I've searched on my hard drive where this "poll.h" file was. I can't find it. I can't find netdb.h or inet.h and a few others either.
These files are not the first ones to be included. I'm saying this to make clear that some files are found but some others are missing. This is what actually happen before I encouter the error:
#include <stdint.h>
#include <stdarg.h>
#include <errno.h>
#include <fcntl.h>
#include <dirent.h>
#include <unistd.h>
#include <signal.h>
#include <sys/poll.h>
As several files are missing I believe I'm missing something big in this issue. Nonethelless I've found out a way to download "poll.h" here. I don't feel comfortable using it... How can I be sure it's the proper file ? What about the other missing files ?
Any suggestion would be really appreciated.
Thanks a lot. Nicolas.