Constructor problem with class
Posted: Wed May 03, 2023 3:21 am
Hi,
I have a problem with a class constructor
This is the header part
And this the constructor
I want to initialize a WIFIserver class TCPserver with a port address
When I compile the code I have two errors at the two lines (51,55)
51 stdio_handler::stdio_handler()
55 stdio_handler::stdio_handler(uint16_t port)
The errors are:
include/stdio_handler.h:51:48: error: no matching function for call to 'WiFiServer::WiFiServer()'
include/stdio_handler.h:55:48: error: no matching function for call to 'WiFiServer::WiFiServer()'
What am I doing wrong
I have a problem with a class constructor
This is the header part
Code: Select all
#include <ESP8266WiFi.h>
#include <WiFiServer.h>
#include <WiFiClient.h>
class stdio_handler {
public:
enum IOports { SERIAL_IO, ATMEGA_IO, TCP_IO, FILE_IO };
stdio_handler();
stdio_handler(uint16_t);
uint16_t printf(const char*, ... );
uint16_t printf(IOports, const char*, ... );
uint16_t printf(IOports, const char*, va_list );
uint16_t scanf(const char* , ... );
uint16_t scanf(IOports, const char* , ... );
uint16_t scanf(IOports, const char* , va_list );
IOports get_state();
size_t available();
uint8_t connect();
private:
WiFiClient TCPclient;
WiFiServer TCPserver;
File fh;
IOports IOprt= SERIAL_IO;
protected:
};
And this the constructor
Code: Select all
stdio_handler::stdio_handler() {
TCPserver.begin(8888);
}
stdio_handler::stdio_handler(uint16_t port) {
TCPserver.begin(port);
}
I want to initialize a WIFIserver class TCPserver with a port address
When I compile the code I have two errors at the two lines (51,55)
51 stdio_handler::stdio_handler()
55 stdio_handler::stdio_handler(uint16_t port)
The errors are:
include/stdio_handler.h:51:48: error: no matching function for call to 'WiFiServer::WiFiServer()'
include/stdio_handler.h:55:48: error: no matching function for call to 'WiFiServer::WiFiServer()'
What am I doing wrong