Before logging an issue, please update to the latest release of Visual Micro from the Downloads Page.

When Logging a Support Issue in the Forum, please ensure you have also:-

  • Enabled vMicro > Compiler > Show Build Properties
  • 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
 
Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Disable VisualMicro deleting comment when combining ino (Read 807 times)
Erin
Newbies
*
Offline


Posts: 5
Joined: May 16th, 2020
Disable VisualMicro deleting comment when combining ino
May 16th, 2020 at 2:37pm
Print Post  
Hi,
I found it that visual micro just deleting all comment (even though it was not a comment) in the code when combining ino files (before compiling). This causes serious issues especially when your code uses string literal. I have a WebServer project. It was running perfectly when compiled using Arduino, but using VisualMicro, it become buggy.

For example, a code like this:
Code (C++)
Select All
static const char HTML_STOPWATCH[] PROGMEM = R"====(
	...
	var ws = 'ws://localhost';
	...
)====";
 


become:
Code (C++)
Select All
static const char HTML_STOPWATCH[] PROGMEM = R"====(
	...
	var ws = 'ws:
	...
)====";
 



As you can see, VisualMicro think that is a comment and delete it even though it was not. When i compare the combined cpp from Arduino (in Temp/arduino_build_xxxx) and cpp from VisualMicro (in VMBuilds folder), it's clear that Arduino didn't remove comments in the code when combining ino files. That's why my code ran perfectly when compiled in Arduino.

My question is is there any setting to disable this behavior? Or if there isn't, please fix this.
Thanks.
  
Back to top
 
IP Logged
 
Erin
Newbies
*
Offline


Posts: 5
Joined: May 16th, 2020
Re: Disable VisualMicro deleting comment when combining ino
Reply #1 - May 18th, 2020 at 5:30am
Print Post  
Hi, Thanks for your reply.
I already add vm.ctags=false but it does not resolve the problem. I attach simple .ino example. Hopefully it will useful for fixing the problem.
MCU: ESP8266, core version: 2.7.1
Arduino 1.8.12

File "board.txt":
Code (C++)
Select All
# ESPTestComment build property overrides
#

vm.ctags=false
 



Example code:
Code (C++)
Select All
// Comment 1: This is a comment
char test0[64] =
"Test 0:\n//This is not a comment\n";

char test1[64] = R"===(
Test 1:
//This is not a comment
)===";

static const char test2[] PROGMEM =
"Test 2:\n//This is not a comment\n";

static const char test3[] PROGMEM = R"===(
Test 3:
//This is not a comment
)===";

// Comment 2: This is also a comment
void setup() {
	delay(500);
	Serial.begin(115200);
	Serial.println("\n\nSTART:");
	Serial.print(test0);
	Serial.print(test1);
	Serial.printf_P(test2);
	Serial.printf_P(test3);
}

void loop() {}
 



VMBuild cpp file:
Code (C++)
Select All
#include <arduino.h>
#line 1 "C:\\Dropbox\\Trial\\ESPTestComment\\ESPTestComment.ino"
#line 1 "C:\\Dropbox\\Trial\\ESPTestComment\\ESPTestComment.ino"

char test0[64] =
"Test 0:\n//This is not a comment\n";

char test1[64] = R"===(
Test 1:

)===";

static const char test2[] PROGMEM =
"Test 2:\n//This is not a comment\n";

static const char test3[] PROGMEM = R"===(
Test 3:

)===";



//
//

#line 19 "C:\\Dropbox\\Trial\\ESPTestComment\\ESPTestComment.ino"
void setup() {
	delay(500);
	Serial.begin(115200);
	Serial.println("\n\nSTART:");
	Serial.print(test0);
	Serial.print(test1);
	Serial.printf_P(test2);
	Serial.printf_P(test3);
}

void loop() {}
 



Serial output:
Code
Select All
START:
Test 0:
//This is not a comment

Test 1:

Test 2:
//This is not a comment

Test 3:


 



As you can see, Test 1 and Test 3 did not print correctly.
  

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


Posts: 12076
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Disable VisualMicro deleting comment when combining ino
Reply #2 - May 18th, 2020 at 9:15pm
Print Post  
Thanks for all the info

Please install the latest release which hopefully resolves the issue.

https://www.visualmicro.com/forums/YaBB.pl?board=VS_ARDUINO_EXT_RELEASES
  
Back to top
WWW  
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint