VS Arduino
Visual Micro >> Installation & Troubleshooting >> void ... previously defined here
https://www.visualmicro.com/forums/YaBB.pl?num=1618257699

Message started by Reinald on Apr 12th, 2021 at 8:01pm

Title: void ... previously defined here
Post by Reinald on Apr 12th, 2021 at 8:01pm
Hi,

I'm trying to port my projects to Visual Micro
I can't get it to work.

the error message i get is:

Server.h:29: note  void TbuildwebPage() previously defined here

I figured out that the problem is that within the function initServerSite a call is made to the function Tbuildwebpage which is below in the code.

in Arduino IDE this problem can be avoided to define the functions in the fcode (see the first 3 code lines)

(It's not possible to set all the functions in the right order because they are ordered in different arduino files.)

I hope there is a solution for these problems, so i can try Visual Micro.


Code (c++):
void TbuildwebPage();
void SetWebIO();
void SetTVon();

void initServerSite() {
  WS.on("sitename", TbuildwebPage);
  WS.on("sitename", SetWebIO);
  WS.on("sitename", SetTVon);
}

void SetTVon() {
  forceTVon = true;
}

void SetWebIO() {
int Adress = WS.arg("a").toInt(); 
int IO =     WS.arg("i").toInt(); 

  if (Adress == RS_ATSPANEL) {
   addATSAreatoBuff(IO, C_TOGGLE);
  }
  else {
    addOutputtoBuff(Adress, IO,C_TOGGLE);
  }
  String Output ="<html><head><meta http-equiv='refresh' content='5;url=sitename'/></head><body>Setting Area/Output: <b>" +String(IO) + "</b><br>Bus-Address: <b>" + String(Adress) +"</b><br>Action: <b>" + "TOGGLE" + "</b><br><br>wait for refresh</body></html>";
  WS.send(200, "text/html", Output );
}
void TbuildwebPage() {
  String Website = "<html><head><title>mysite</title></head><body><script>document.body.style.zoom='250%';</script><table border='0'>";
 
  File myFile = SD.open("/Settings/IOlist.ini");

  bool state;
  String imgurl;
  String imgname;

  while (myFile.available()) {
   
    char   RawAdress[2] = {myFile.read(),myFile.read()};
    int IOadress = hexToDec(&RawAdress[0],2);
   
    String IOnum = myFile.readStringUntil(',');

    if (IOnum == "A") { //Speciale IO (douchefan)   
    }
   
   
    String IOname = readFileLine(myFile);


    if (IOadress == RS_ATSPANEL) {
      state = GetSetIOstatus(IOadress, C_AREA, IOnum.toInt());
      imgname = (state == true) ? "img" : "img";
    }
    else {
      state = GetSetIOstatus(IOadress, C_OUTPUT, IOnum.toInt());
      imgname = (state == true) ? "img" : "img";
    }
    Website += "<tr><td><img src='http://sitename + imgname + "'></td><td><a href='/site?a=" + String(IOadress) + "&i=" + IOnum + "'>" + IOname + "</a></td></tr>";

  }
  Website += "</table></body></html>";
  Serial.println(Website);
  WS.send(200, "text/html", Website);
}


Title: Re: void ... previously defined here
Post by Tim@Visual Micro on Apr 12th, 2021 at 8:27pm
hI

Please follow the guide in the yellow box near the top of this page and also zip/email your project folder so we can see your source code. Thanks

Title: Re: void ... previously defined here
Post by Reinald on Apr 13th, 2021 at 10:07am
Hi,

I'm very sorry, i missed the yellow header  :-[
I emailed the source code; the output of the compiler is posted here

i hope this will help.

Regards,

Reinald
https://www.visualmicro.com/forums/YaBB.pl?action=downloadfile;file=vmicro_output_001.txt ( 283 KB | 12 Downloads )

Title: Re: void ... previously defined here
Post by Tim@Visual Micro on Apr 15th, 2021 at 1:38pm
It would help to know where you downloaded the custom libraries that you are using.

For reference, here is the list of libs you have installed and used. If they are in the library manager you can simply confirm the name.

Using library UseFullFunctions version 0.0.0 in folder "file:///C:/arduino/ArduinoLibs/libraries/UseFullFunctions"
Using library ErriezDS1302 version 1.0.0 in folder "file:///C:/arduino/ArduinoLibs/libraries/ErriezDS1302"
Using library EasyNTPClient version 1.1.0 in folder "file:///C:/arduino/ArduinoLibs/libraries/EasyNTPClient"
Using library HomeProject2 version 0.0.0 in folder "file:///C:/arduino/ArduinoLibs/libraries/HomeProject2"
Using library Hex2Dec version 0.0.0 in folder "file:///C:/arduino/ArduinoLibs/libraries/Hex2Dec"
Using library SerialMenu version 1.0.0 in folder "file:///C:/arduino/ArduinoLibs/libraries/SerialMenu"
Using library COM485 version 2.1.1 in folder "file:///C:/arduino/ArduinoLibs/libraries/COM485"

Please also confirm that the Arduino IDE File>preferences shows a sketchbook folder of "C:/arduino/ArduinoLibs"? This will confirm that Visual Micro and the Arduino IDE are looking in the same location for downloaded libraries.

Title: Re: void ... previously defined here
Post by Reinald on Apr 29th, 2021 at 7:56pm
the sketch is now working, most of these libraries are written by myself.

it was on my list to rewrite parts of the code an do a little cleanup so the compile error was a nice opportunity to do this.

VS Arduino » Powered by YaBB 2.6.12!
YaBB Forum Software © 2000-2024. All Rights Reserved.