Support Board
Date/Time: Mon, 24 Feb 2025 22:17:21 +0000
[Programming Help] - Request for VS2019 template- either Project or Solution for SC X64 dlls to put my custom
View Count: 2167
[2020-04-22 03:24:21] |
JohnR - User831573 - Posts: 314 |
Not to anger anyone, but I really prefer to stay in one tool VS2019, instead of NotePad++ & Sierra menu's to build. I have successfully built one study, compiled and built using NP + internal Build. I have been digging in your docs and support forums, watched a few YouTubes, read some MSFT docs, but still have not gotten something right or left something out. If one of you folks have set this up, it would be appreciated if you would share. You can private message me if you prefer. I do realize I will have to change output file locations, and I think possibly some include directories. Depending on Drv:\SubDir I have things installed in. Also, if people have a / some URLs pointing me to starting / tips, that would be appreciated. Hopefully, I will get smarter, and not fall in the same hole again, and again,and again. hehehe. Thanks in advance. John |
[2020-04-22 08:21:02] |
Flipper - Posts: 65 |
This isn't a template but these are the important settings
|
![]() Attachment Deleted. ![]() |
[2020-04-22 08:22:55] |
Flipper - Posts: 65 |
Oh and change/delete Precompiled Headers
|
![]() |
[2020-04-22 12:58:34] |
JohnR - User831573 - Posts: 314 |
Flipper, Many, many thanks. Woohoo ! ! !. I had the option with the Precompiled Header - wrong. I miss stuff like this at times. I have many years in past of coding, but more recently, I am self taught C# used in Ninja, and now C++ for here on Sierra. Now and then I get my knickers in a knot, as the devil is in the details. Again, thanks for your time. JohnR |
[2020-04-23 01:27:52] |
User701453 - Posts: 176 |
So how did the two of you manage to get past all the errors in the VAPContainer.h and the scstructures.h that are returned when trying to build the solution? Image of errors attached. SC has not been able to provide a working solution to these errors. I'm using SC version 2086, VS version 2017. I also get the same errors when trying to build with VS 2010. |
![]() |
[2020-04-23 01:40:10] |
Flipper - Posts: 65 |
Oh! could you show us some more information? Maybe the VS project properties and the basic structure of code thats causing the problem?
|
[2020-04-23 01:43:14] |
Flipper - Posts: 65 |
Does the .cpp code work when you use the "Analysis>Build Advanced Custome Studies DLL>Build>Remote Build"
|
[2020-04-23 09:00:42] |
User701453 - Posts: 176 |
Does the .cpp code work when you use the "Analysis>Build Advanced Custome Studies DLL>Build>Remote Build"
Yes, it does and it works when built with c++ debug.I have been debugging the .cpp file that way because I could never get the VS project to build due to all the errors reported in the SC files. I was hoping you guys had solved the SC file errors so I could use the advanced feature of Edit and Continue within VS with is currently not possible using SC "Analysis>Build Advanced Custom Studies DLL>Build>Build with Visual c++ debug". |
[2020-04-23 09:37:29] |
User907968 - Posts: 833 |
@User70143 The error is in your VS configuration or in your local copies of SC files used for VS build |
[2020-04-23 10:40:31] |
Flipper - Posts: 65 |
Yeah it would seem there is a configuration problem on your end. Visual studio sets up and build SC .dll with no problem if I use the setting I posted post #2 & #3. Have you also got the "VAPContainer.h" & "scstructures.h" file in C:\SierraChart\ACS_Source and the VS > Project > Properties > All Configurations > Configuration Properties > C/C++ > General > Additional Include Directories > C:\SierraChart\ACS_Source |
[2020-04-23 16:04:29] |
JohnR - User831573 - Posts: 314 |
I have an additional "\" slash at the end. Not sure if that is it. C/C++ > General > Additional Include Directories > slash added to end C:\SierraChart\ACS_Source\ instead of C:\SierraChart\ACS_Source I am converting my code from another platform so I am keeping each study in its own dev project/sol and when tested and working as designed, putting the study into a run-time version of all studies, within one set of files with sc.FreeDLL = 0: For me to consistently work - be able to debug, and also end up with with a working .dll in ...Data dir, I am using the suggestions given by Flipper. Make sure you have the things he points out in his 3 .PNG files. Also, it could be I am old and losing an edge (less brain cells), I am following steps listed below as I make a new solution. I am doing one for each indicator, as I wanted to migrate each one and keep them separate during dev / debug. When I tried things like Add->existing source file, or some other try at using prior built templates, I had a failure either in it couldn't find stuff, or errors in the compile. Sequence I took to be able to compile & debug within VS2019 Community Ed. and SierraChart 64 bit bld 2091 1 - Always create a new empty project. Naming it what you choose, placing it in dir structure you choose. 2 - Now to add a new C++ source file. Also name it what you want. 3 - Time to set properties - options & configurations. Keeping with Flippers suggestions, start with the Solution. - Make sure you end up with correct platform. x64 or x86. 4 - Next set properties for Project 5 - Set properties for .cpp - source file 6 - Next I open a view / window to see the empty source file. 7 - Copy / Paste the source of your indicator code into this file. - I've been using NotePad++ as the program to open my sample pieces of code to be using in this indicator. - And since it works and it repeatable, I will do it this way, but smarter people may be able to do it all in VS easier. 8 - Save .cpp file and then do Save All You should now be ready to 'Build" and then start a debug session if you want Hope this helps. JohnR Date Time Of Last Edit: 2020-04-23 16:34:40
|
[2020-04-26 19:47:59] |
User701453 - Posts: 176 |
Want to report back and say thanks to everyone for the help and assistance with finally getting Visual Studio to work with Sierra I took a VM snapshot first as I didn't want to screw up my current working setup. I uninstalled all version of VS and rebooted. Ran VS 2017 install and selected every option available related to c++ After rebooted,opened the project and it compiled with no issues. Started SC and added the new VS compiled dll to the chart. Attached to the process,set breakpoints and replayed the chart. When breaks was hit I was finally able to modify code use the edit and continue feature of VS. |
[2021-03-17 01:24:22] |
silvereagle - Posts: 23 |
Hi friends, I am able to build a custom study via the remote build, however, I wanted to use Visual Studio for more control --and ran into trouble. I’ve gone step by step through trying to build a custom study with Visual Studio and I think I’m really close --but no cigar. Hoping someone might be able to point out a missed configuration setting or otherwise point me in the right direction. SierraChart Version: 2231 64-bit Visual Studio 2019 (C++ Dev Package) --> Running on Parallels (Basically Mac Running Windows 10 with Visual Studio installed) 1. Create Empty Solution (HelloWorld) 2. Configure Solution Build Properties - Debug: x64 - Release: x64 3. Configure Project Properties + General - Target Name: $(ProjectName)_64. --> outputs file named HelloWorld_64.dll to conform to SC naming conventions - Configuration Type: Dynamic Library (.dll) + C/C++ - Additional Include Directories: /Path/To/SierraChart2231/ACS_Source - Precompiled Headers: Not Using Precompiled Headers 4. Add HelloWorld.cpp 5. Paste in the same code that builds Remotely with Sierra. 6. Change the #include statement at the top of the file to point to sierrachart.h: + #include “C:\Users\curt\source\SierraChart2231\ACS_Source\sierrachart.h” 7. Changed SCDLLName + SCDLLName(“HelloWorld Study DLL”) After I get this set up, I am able to build successfully and get my HelloWorld_64.dll. Next, I copy/paste the dll into the SierraChart2231/Data directory (where the other remotely built studies/dlls are) Next, I then restart Sierra and look at the log and see no errors. I do see a log line that looks like this: DLLs: HelloWorld_64.dll UserContributerdStudies_64.dll So it it seems Sierra picks up the dll, however when I try to add the study to a chart, I do not see it available to select. Viewing the message log, I can see UserContributedStudies.dll loaded, but I do not see anything for the custom HelloWorld_64.dll. I imagine if it loaded successfully there would be a line like: Loading DLL: /Path/To/SierraChart2231/HelloWorld.dll (HelloWorld_64.dll). Handle dc00000 | etc... etc... but there is not, so I assume the it's not loading properly for some reason and thus not available for selection. I’ve been scouring the boards and found that some say that studies don’t show in the GUI if they were compiled for a mismatched architecture, that is to say compiling 32 bit when you’re running 64, however, I made sure I’m compiling for 64 bit and that Sierra is running 64 bit. I’m stumped. I would super appreciate any ideas on what I can either double check configuration wise or any other troubleshooting steps to get a "hello world" going... thanks :) |
[2021-03-17 02:06:21] |
Ticks - Posts: 198 |
What is the name and format you used in the SCSFExport function?
|
[2021-03-17 02:47:30] |
Flipper_2 - Posts: 57 |
Are you looking in the "Add Custom Study" button. Just followed your steps and works fine.
Date Time Of Last Edit: 2021-03-17 02:49:57
|
![]() |
[2021-03-18 00:23:00] |
silvereagle - Posts: 23 |
@Ticks For the SCSFExport function I'm using scsf_HelloWorld(SCStudyGraphRef sc). Originally I had the default scsf_TemplateFunction(SCStudyInterfaceRef sc), but with your hint I dug around source and found another way that function was declared and tried that ---still no cigar though. :( After losing more hair to this problem I jumped on my native windows machine and used VS 2019 to build the dll over there using all the same steps. I just wanted process of elimination that it wasn't some obscure issue from running VS on the other machine in Parallels. So, I built that dll on the native windows machine, popped'er in Sierra, restarted... And proceeded to lose more hair. No go for launch. It just wont show up in the Add Custom Study GUI @User925080 Yep, that's where I'm lookin' sir and seein' a whole lotta nothin. lol. I really-really appreciate the extra thoughts, if you have any other things I might try or check that would be awesome... as I'm really running out of ideas. |
![]() |
[2021-03-18 00:41:20] |
Flipper_2 - Posts: 57 |
Just to have another set of eyes on it give us a screen shot of the VS property pages, General, C/C++ General and Precompiled Headers as well as all the code as text like this, #include "C:\SierraChart\ACS_Source\sierrachart.h"
SCDLLName("HelloWorld Study DLL") SCSFExport scsf_UniqueFunctionName(SCStudyInterfaceRef sc) { if (sc.SetDefaults) { // Set the defaults sc.GraphName = "My New Study Function"; sc.Subgraph[0].Name = "Subgraph name"; sc.Subgraph[0].DrawStyle = DRAWSTYLE_LINE; sc.AutoLoop = 1; // Enter any additional configuration code here return; } // Perform your data processing here. // Multiply the Last price at the current bar being processed, by 10. sc.Subgraph[0][sc.Index] = sc.Close[sc.Index] * 10; return; } |
[2021-03-18 23:24:54] |
silvereagle - Posts: 23 |
Appreciate the suggestion User925080 :) Made some progress last night. Long story short, I think it's something to do with running Sierra on mac using crossover windows7x64 bottle. I continued troubleshooting between my mac and pc and this is what I found. 1. On Win10 Native machine I built HelloPluto C++ dll WINResult --> The study showed up in native SierraChart2231 GUI on native installation Win10 2. On Mac I built HelloWorld C++ dll - Parallels - Windows 10 - Installed the visualcppbuildtools_full.exe (This let me target the 2015 compiler as a build option in VS 2019) - VS 2019 Community - HelloWorld C++ Project WINResult --> The HelloWorld study showed up in native SierraChart2231 GUI on native installation Win10 MACResult --> HelloWorld Study did not show up in SierraChart2231 running on crossover windows7x64 bottle This leads me to conclude the native Win10 machine simply "has things" libraries or header files that are required for the study to load and that the crossover mac windows7 bottle does not "have things". Taking a closer look at dll file sizes compiled on both machines, I see that: HelloPluto_64.dll is 104kb HelloWorld_64.dll is 108kb Interestingly, the same study cpp source code that is submitted to the remote Sierra build server which deposits the dll into the data directory on the mac comes back weighing 911kb. So whatever they are doing, they are adding quite a bit to that dll coming back. Any ideas on this? I tried including the windows header file in the study thinking that might be my next troubleshooting stop, but that did not seem to work. #include <Windows.h> When I tracked down the Windows.h file, I also saw that it was only 7kb --which is counter to what I had thought it would be. I thought I remember it being huge as it was basically the "one header file to rule them all". I'm probably missing something or forgetting something. It's been 20 years since I put on the cpp hat. Any ideas on what libs or headers or compile process is being used to generate the 911kb study dll? Just wondering if I can replicate that on my end. Lastly, I know this probably is now beyond the scope of the thread --seems to have morphed into an environment/compile issue for running on mac so I appologize if it's off topic. Unfortunately, most everywhere I look on the boards the message seems to be that the Sierra developers have no interest in supporting Visual Studio build processes, which is why they came up with the remote build server. And they do seem to get a bit...ahem... upset if you ask about it. lol Again, thanks all for being a helpful bunch --really diggin' the sense of community here. :) Curt |
[2021-03-19 09:07:21] |
User907968 - Posts: 833 |
Windows.h is already included via sierrachart.h Do you have runtime library set correctly in your VS solution? If not already, use /MT (or for debug build /MTd) option. Configuration Properties -> C++ -> Code Generation -> Runtime Library https://docs.microsoft.com/en-us/cpp/build/reference/md-mt-ld-use-run-time-library?view=msvc-160 |
To post a message in this thread, you need to log in with your Sierra Chart account: