C++ components
Posted: Thu Sep 19, 2019 11:01 am
I found an nice esp32 library on https://github.com/fhessel/esp32_https_server
it is also using the Arduino librari.
As I prefered using real esp libraries without arduino, i decided to change the code to make it working without include arduino.h.
The library is written in C++ and i have troubles compiling it when the base program is in C.
The code causing this error is:
I have seen there where some troubles with include string a lot of time ago, but the solution was upgrading the source.
git describe
v4.1-dev-256-g9f145ff16
xtensa-esp32-elf-cc --version
xtensa-esp32-elf-cc (crosstool-NG esp32-2019r1) 8.2.0
Can I include c++ components to c programs? It compiles when the program is c++.
Why it doesn't recongnise this include?
it is also using the Arduino librari.
As I prefered using real esp libraries without arduino, i decided to change the code to make it working without include arduino.h.
The library is written in C++ and i have troubles compiling it when the base program is in C.
Code: Select all
error: 'string' in namespace 'std' does not name a type
HTTPHeader(const std::string &name, const std::string &value);
The code causing this error is:
Code: Select all
#ifndef SRC_HTTPHEADER_HPP_
#define SRC_HTTPHEADER_HPP_
#include <string.h>
namespace httpsserver {
/**
* \brief Represents a single name/value pair of an HTTP header
*/
class HTTPHeader {
public:
HTTPHeader(const std::string &name, const std::string &value);
virtual ~HTTPHeader();
const std::string _name;
const std::string _value;
std::string print();
};
} /* namespace httpsserver */
#endif /* SRC_HTTPHEADER_HPP_ */
I have seen there where some troubles with include string a lot of time ago, but the solution was upgrading the source.
git describe
v4.1-dev-256-g9f145ff16
xtensa-esp32-elf-cc --version
xtensa-esp32-elf-cc (crosstool-NG esp32-2019r1) 8.2.0
Can I include c++ components to c programs? It compiles when the program is c++.
Why it doesn't recongnise this include?