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 VM_DBG.cpp: 397:22: error: array subscript has type 'char' (Read 1031 times)
Kabron
Full Member
***
Offline


Posts: 170
Joined: Nov 1st, 2015
VM_DBG.cpp: 397:22: error: array subscript has type 'char'
Jun 16th, 2020 at 11:24am
Print Post  
Hello,
Board LilyGO-T-Watchband (ESP32 Pico)
In Debug mode(not in Release) I got:
Code
Select All
VM_DBG.cpp: 397:22: error: array subscript has type 'char' [-Werror=char-subscripts]
   pinStr[pinCharRead] = nxt
cc1plus.exe*: some warnings being treated as errors 


The problem code is:
Code (C++)
Select All
	char pinStr[4];
	char pinCharRead = 0;
	if (nxtChar == 'd') {
		// Read Our message back -> dxxxx:1 where xxxxx is the pin number (must be a number!)
		read(); // Remove d
		char nxt = read();
		while (nxt != ':') {
			pinStr[pinCharRead] = nxt; 


I see no any criminal.
What is the reason and how to solve it.
Code translated to VM from here:
https://github.com/TioRuben/TTGO-T-Wristband.git

Thanks in advance
« Last Edit: Jun 16th, 2020 at 11:26am by Kabron »  
Back to top
 
IP Logged
 
Simon@Visual Micro
Administrator
*****
Offline


Posts: 2175
Joined: Feb 13th, 2019
Re: VM_DBG.cpp: 397:22: error: array subscript has type 'char'
Reply #1 - Jun 16th, 2020 at 11:39am
Print Post  
This is due to the pinCharRead being a char (which can be signed on some platforms).

if you change it to unsigned char, or byte/uint this should also resolve the issue.
  
Back to top
 
IP Logged
 
Kabron
Full Member
***
Offline


Posts: 170
Joined: Nov 1st, 2015
Re: VM_DBG.cpp: 397:22: error: array subscript has type 'char'
Reply #2 - Jun 16th, 2020 at 1:02pm
Print Post  
Exellent answer!
Thanks a lot!
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint