Login Page - Create Account

Support Board


Date/Time: Sat, 10 May 2025 17:12:28 +0000



Global variable

View Count: 1448

[2016-01-14 20:21:04]
ertrader - Posts: 682
Hi Support... I'm trying to create a global variable using the code in documenation:

#include "SierraChart.h"
SCDLLName("StudiesFileName")

//This is a global integer variable
int g_GlobalIntegerVariable;

SCSFExport scsf_StudyFunction
{
if (sc.SetDefaults)
{
sc.FreeDLL = FALSE;
}

}


When I try to compile, I get the following error:

-- Starting build of Custom Studies Source files: GlobalVariables.cpp. -- 14:16:37

"C:\SierraChart\CPPCompiler\bin\g++.exe" "C:\SierraChart\ACS_Source\GlobalVariables.cpp" -march=i686 -mtune=i686 -O2 -shared -static -static-libgcc -static-libstdc++ -s -fno-rtti -fno-exceptions -std=gnu++11 -o "C:\files\Sierra_Data\GlobalVariables.dll"

C:\SierraChart\ACS_Source\GlobalVariables.cpp:7:12: error: variable or field 'scsf_StudyFunction' declared void
SCSFExport scsf_StudyFunction
^
C:\SierraChart\ACS_Source\GlobalVariables.cpp:9:5: error: expected primary-expression before 'if'
if (sc.SetDefaults)
^
C:\SierraChart\ACS_Source\GlobalVariables.cpp:9:5: error: expected '}' before 'if'
C:\SierraChart\ACS_Source\GlobalVariables.cpp:14:1: error: expected declaration before '}' token
}
^
-- End of Build -- 14:16:38

Can you please let me know what am I doing wrong?

Thank you!
Date Time Of Last Edit: 2016-01-14 20:22:31
[2016-01-14 20:21:50]
ertrader - Posts: 682
http://www.sierrachart.com/index.php?page=doc/doc_ACSILProgrammingConcepts.html#GlobalVariables
[2016-01-15 03:49:30]
Sierra Chart Engineering - Posts: 104368
The code example has been corrected.

Reload that page for the updated example.
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, *change* to 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