After reading this thread http://arduino.cc/forum/index.php/topic,120624.0.html i try this but Error of multiple defination start occuring what is the reason behind it?
I really appreciate your suggestions.
Sketch
#include "WebPages.h"
#include <SPI.h>
#include <Ethernet.h>
#include "WebServer.h"
WebPages Pages;
void setup()
{
Pages.setup();
}
void loop()
{
Pages.servProcess();
}
WebPages.h
#ifndef WebPages_h
#define WebPages_h
#include "WebServer.h"
#include "Arduino.h"
#include <SPI.h>
#include <Ethernet.h>
class WebPages
{
public:
WebPages();
void setup();
void servProcess();
private:
static void defaultCmd(WebServer &server, WebServer::ConnectionType type, char *url_tail, bool tail_complete);
};
//extern WebPages Pages;
#endif
WebPages.cpp
#include "WebPages.h"
#include <SPI.h>
#include <Ethernet.h>
#include "Arduino.h"
template<class T>
inline Print &operator <<(Print &obj, T arg)
{ obj.print(arg); return obj; }
static uint8_t mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
static uint8_t ip[] = { 192, 168, 1, 210 };
#define PREFIX ""
WebServer webserver(PREFIX, 80);
WebPages::WebPages()
{
//created
}
void WebPages::defaultCmd(WebServer &server, WebServer::ConnectionType type, char *url_tail, bool tail_complete)
{
P(htmlHead) =
"<html>"
"<head>"
"<title>Arduino Web Server</title>"
"<style type=\"text/css\">"
"BODY { font-family: sans-serif }"
"H1 { font-size: 14pt; text-decoration: underline }"
"P { font-size: 10pt; }"
"</style>"
"</head>"
"<body>"
"TEST"
"</body>";
server.httpSuccess();
server.printP(htmlHead);
}
void WebPages::setup()
{
Ethernet.begin(mac, ip);
webserver.begin();
webserver.setDefaultCommand(&WebPages::defaultCmd);
}
void WebPages::servProcess()
{
webserver.processConnection();
}
//WebPages Pages = WebPages();
WebServer.h file of webduino
ERRORS
WebPages\WebPages.cpp.o: In function
WebServer::setDefaultCommand(void (*)(WebServer&, WebServer::ConnectionType, char*, bool))': /WebServer.h:356: multiple definition of
WebServer::setDefaultCommand(void ()(WebServer&, WebServer::ConnectionType, char, bool))'
Webpages.cpp.o:D:\arduino-1\libraries\WebPages/WebServer.h:356: first defined here
WebPages\WebPages.cpp.o: In functionWebServer::setFailureCommand(void (*)(WebServer&, WebServer::ConnectionType, char*, bool))': /WebServer.h:361: multiple definition of
WebServer::setFailureCommand(void ()(WebServer&, WebServer::ConnectionType, char, bool))'
Webpages.cpp.o:D:\arduino-1\libraries\WebPages/WebServer.h:361: first defined here
WebPages\WebPages.cpp.o: In functionWebServer::addCommand(char const*, void (*)(WebServer&, WebServer::ConnectionType, char*, bool))': /WebServer.h:364: multiple definition of
WebServer::addCommand(char const*, void ()(WebServer&, WebServer::ConnectionType, char, bool))'
Webpages.cpp.o:D:\arduino-1\libraries\WebPages/WebServer.h:364: first defined here
WebPages\WebPages.cpp.o: In function `WebServer::push(int)':
Other in txt attach file
error.txt (11.1 KB)