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

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.

Related

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

catastrophic error: cannot open source file "stdlib.h"

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/

Compiling SDL2 Error in Terminal (Confused about how to include SDL2 library)

I'm learning SDL2 right now and I'm working in XCode for the most part as I code. However, I want to run my program in terminal to use valgrind, but whenever I try, I get this error:
fatal error: 'SDL2/SDL.h' file not found
I'm compiling in a really simple way as follows:
g++ Camera.cpp LTexture.cpp LTimer.cpp LWindow.cpp Player.cpp Tile.cpp TileMap.cpp main.cpp -o main
I know that I'm supposed to be including the SDL2 library somehow, but I'm unsure of how to do that. Right now, the framework is sitting in the folder /Library/Frameworks/SDL2.framework
Any help on this would be greatly appreciated. Thanks in advance.
Add
-I/Library/Frameworks/SDL2.frameworks/Headers
to your g++ command and change
'SDL2/SDL.h'
include to just
'SDL.h'
in your header/(s) since /Library/Frameworks/SDL2.frameworks/Headers doesn't contain an SDL2 folder (usually)
Now that you changed the #include "SDL2/SDL.h" to #include "SDL.h" you want to go open your Xcode project, select your target, go to build settings and add /Library/Frameworks/SDL2.frameworks/Headers to Header Search Paths in order to fix Xcode's 'Couldn't find 'SDL.h'' error message.
Update:
Another way would be linking (using ln) /Library/Frameworks/SDL2.frameworks/Headers to /usr/local/include/SDL2, add -I/usr/local/include/SDL2 to your g++ command
and leave the #include as is ('SDL2/SDL.h')

missing an existing c file. fatal error: g/protobuf-c/protobuf-c.h: No such file or directory

I'm working on an android app with native code (using JNI).
I try to build my c project in eclipse and get this error:
/Users/e/MyWorkspace/Client/src/android/java/jni/../../../protobuf/w/inbox.pb-c.h:6:42: fatal error: g/protobuf-c/protobuf-c.h: No such file or directory
this is inbox.pb-c.h:6:42:
/* Generated by the protocol buffer compiler. DO NOT EDIT! */
#ifndef PROTOBUF_C_inbox_2eproto__INCLUDED
#define PROTOBUF_C_inbox_2eproto__INCLUDED
42: #include <g/protobuf-c/protobuf-c.h>
PROTOBUF_C_BEGIN_DECLS
searching with mac's index I see this file exist.
That's weird as it compliation stopped to work a few hour ago all the sudden without me touching this file.
how can I solve this?

C++ Problems with #include <anyfile.h> when trying to compile a gstreamer app

I didn't find anything like this when I searched for it. I'm trying to make a simple gstreamer app based on code I found in another stack overflow thread. Whenever I try to compile it by going to the directory with command prompt and entering cl cppgstreamer.cc. Initially, the only include was #include <gstreamermm.h>, which gives me
cppgstreamer.cc(1) : fatal error C1083: Cannot open include file: 'gstreamermm.h
': No such file or directory
Even when I put cppgstreamer.cc into the same directory as gstreamermm.h. I then tried changing the include to
#include "C:\Users\MY_NAME\Documents\gstreamer c++\gstreamermm-0.10.10.2\gstreamer\gstreamermm.h"
with MY_NAME being replaced by my name.
This seems to work, but then it tries to do the includes in the gstreamermm.h, and they are in #include <file.h> form, so I get another fatal error C1083,except this time with init.h, or when I changed that, error.h. And they have dependencies. Is there a way that I can get my compiler to like the #include <file.h> syntax? I really don't want to go through the file and change every #include <file.h> to #include "file.h".
Sorry if this is a dumb question. I'm new to C++, although I've worked with C in the past.
I am using Microsoft Visual C++ Express 2010. Any help would be appreciated. Thanks!
You need to add the directory containing gstreamermm.h to include path. I don't have visual c++ here to check, but it's in somewhere in project properties under C/C++ .