Welcome, Guest. Please Login or Register
Arduino IDE for Visual Studio
 
 
When Logging a Support Issue in the Forum, please ensure you have also:-
  • Enabled vMicro > Compiler > Show Build Properties and Verbose
  • Re-Compile your program with these settings enabled
 
Save the new Output to a Text File and....
  • Click the Reply button and attach as .txt file OR
  • Click here to Email us with the file attached, and a link to your post
Support requests without the output above may be impossible to answer, so please help us to help you
 
  HomeSearch Tutorials & Wiki visualmicro.com LoginHelpRegister  
 
Page Index Toggle Pages: 1
Send Topic Print
void ... previously defined here (Read 196 times)
Reinald
Newbies
*
Offline



Posts: 4
void ... previously defined here
Apr 12th, 2021 at 9: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);
}

 

Back to top
 
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline



Posts: 11023
United Kingdom
Re: void ... previously defined here
Reply #1 - Apr 12th, 2021 at 9: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
Back to top
 

Tim Leek
home
WWW  
IP Logged
 
Reinald
Newbies
*
Offline



Posts: 4
Re: void ... previously defined here
Reply #2 - Apr 13th, 2021 at 11:07am
 
Hi,

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

i hope this will help.

Regards,

Reinald
Back to top
 

Please Register or Login to the Forum to see File Attachments
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline



Posts: 11023
United Kingdom
Re: void ... previously defined here
Reply #3 - Apr 15th, 2021 at 2: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.
Back to top
 

Tim Leek
home
WWW  
IP Logged
 
Reinald
Newbies
*
Offline



Posts: 4
Re: void ... previously defined here
Reply #4 - Apr 29th, 2021 at 8: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.
Back to top
 
 
IP Logged
 
Page Index Toggle Pages: 1
Send Topic Print