Login Page - Create Account

Support Board


Date/Time: Fri, 19 Apr 2024 20:44:09 +0000



[Programming Help] - whay do i get no operator "[]" matches these operands error in Visual Studio Debuding?

View Count: 3798

[2021-07-05 13:34:50]
User30743 - Posts: 364
whenever i need to debug some piece of code where there are [] i get this error message

no operator "[]" matches these operands

https://prnt.sc/18r1m5j

How is it possible that [] operator is not supported? i don't get it.

How do i get to see the value? it makes debugging almost impossible
Date Time Of Last Edit: 2021-07-05 13:37:45
[2021-07-05 14:39:57]
User907968 - Posts: 802
Something is wrong with your config, but without more information who can say what it is?
[2021-07-05 18:05:10]
User30743 - Posts: 364
Visual Studio config?

what more information do u need?

this is my solution config https://prnt.sc/18svrwv
[2021-07-08 15:17:58]
bradh - Posts: 853
How is it possible that [] operator is not supported? i don't get it.

How do i get to see the value? it makes debugging almost impossible

The [] Operator in this case means the debugger doesn't recognize the individual array elements.

I don't know how to get the VS debugger watch list to let you look at specific elements of an array, or if it is even possible. I asked this a long time ago and got no answer.

This is what I do to work around that. Create a persistent variable, assign it to the value of sc.Close[sc.Index] and add the persistent variable to the watch list. You can use a regular variable, but if you want to only break when the value changes, it will always reset each time the study is called. With a persistent variable you won't have that problem.

float& ClosePrice = sc.GetPersistentFloat(0);
ClosePrice = sc.Close[sc.Index];

[2021-07-08 17:11:17]
User907968 - Posts: 802
Nice catch, hadn't spotted it was being used in a 'watch', had assumed 'autos' or 'locals'.
[2021-07-08 17:38:51]
John - SC Support - Posts: 30976
To get the VS Debugger to show the values of an array or vector you can add the following after the variable in the Watch list:
+ offset, count

Where 'offset' is the number of items to skip forward and 'count' is the number of items to display. You can omit the '+offset' and just use the ', count'.

For example, if you want to display items 101 - 110, you could add '+ 100, 10' after the variable in the watch list.
For the most reliable, advanced, and zero cost futures order routing, use the Teton service:
Sierra Chart Teton Futures Order Routing
[2021-07-17 11:59:32]
User30743 - Posts: 364
i am sorry, but i dont get it.

i want to see this value

sc.BaseDateTimeIn[sc.IndexOfLastVisibleBar] -- i get error https://prnt.sc/1c663cz

when i write

sc.BaseDateTimeIn + sc.IndexOfLastVisibleBar, 1 -- i get another error https://prnt.sc/1c67np7

sow what do i do to make the variable visible?


---

another similar issue. i have a SCDateTime variable

when i want to see .GetHour() value i get this message -- https://prnt.sc/1c694ig

is there any setting i need to do in order to see it?
Date Time Of Last Edit: 2021-07-17 12:03:00

To post a message in this thread, you need to log in with your Sierra Chart account:

Login

Login Page - Create Account