Login Page - Create Account

Support Board


Date/Time: Tue, 26 Nov 2024 06:56:54 +0000



Provided .cpp won't compile

View Count: 272

[2023-12-17 00:54:22]
j4ytr4der_ - Posts: 938
I'm trying to work with the Trading System Based On Alert Condition source code provided with SC. On attempting to compile it however (after I give it a DLL name), I get the following error:

In file included from scstructures.h:109,
from sierrachart.h:22,
from TradingSystemBasedOnAlertCondition.cpp:1:
In constructor 'SCString::SCString(const char*)',
inlined from 'void scsf_TradingSystemBasedOnAlertCondition(SCStudyInterfaceRef)' at TradingSystemBasedOnAlertCondition.cpp:272:54:
SCString.h:174:11: warning: 'char* strncpy(char*, const char*, size_t)' specified bound depends on the length of the source argument [-Wstringop-overflow=]
174 | strncpy(m_String, SourceString, StringLength);
| ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
SCString.h: In function 'void scsf_TradingSystemBasedOnAlertCondition(SCStudyInterfaceRef)':
SCString.h:735:36: note: length computed here
735 | const size_t StringLength = strlen(String);
| ~~~~~~^~~~~~~~

-- End of Build -- 18:50:39

This appears to be an internal issue I can't do anything about. Is there some fix for this? I'm running build 2568.
[2023-12-17 03:23:45]
Sierra_Chart Engineering - Posts: 17179
Change this:
const size_t StringLength = strlen(String);

to:

const size_t StringLength = String.GetLength();

Sierra Chart Support - Engineering Level

Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy:
https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation

For the most reliable, advanced, and zero cost futures order routing, use the Teton service:
Sierra Chart Teton Futures Order Routing
[2023-12-17 06:06:14]
j4ytr4der_ - Posts: 938
Thanks, but that line does not exist within the .cpp provided.
[2023-12-17 06:07:06]
j4ytr4der_ - Posts: 938
Note that the error message is not to do with the code I'm compiling, it's referring to something within SC.
[2023-12-17 16:52:40]
Sierra_Chart Engineering - Posts: 17179
Disregard the warning. It is incorrect. It is not going to cause any problem.
Sierra Chart Support - Engineering Level

Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy:
https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation

For the most reliable, advanced, and zero cost futures order routing, use the Teton service:
Sierra Chart Teton Futures Order Routing
[2023-12-17 17:17:16]
j4ytr4der_ - Posts: 938
But the study won't compile. How do I disregard the warning and make it compile anyway?
[2023-12-17 19:57:07]
Sierra_Chart Engineering - Posts: 17179
We need more time to look into this.
Sierra Chart Support - Engineering Level

Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy:
https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation

For the most reliable, advanced, and zero cost futures order routing, use the Teton service:
Sierra Chart Teton Futures Order Routing

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

Login

Login Page - Create Account