Support Board
Date/Time: Tue, 25 Feb 2025 17:07:53 +0000
[Programming Help] - std::map is causing CPU exception
View Count: 800
[2021-04-19 02:03:21] |
User641030 - Posts: 13 |
Hi, I'm on SC version 2245 64-bit. I'm writing a custom study that creates a simple map inside a class. The map insert method is throwing a warning: The custom dll 'name...' has just caused a CPU exception. It does not proceed after the warning. I'm using Visual studio 2019 16.9.4 to build it locally. I've pasted snippets of code relevant to the issue: ############## Creating object in sc.SetDefaults ################# TestClass* testObj= (TestClass*)sc.GetPersistentPointer(1); if (testObj == NULL){ testObj = (TestClass*) new TestClass; if( testObj != NULL) sc.SetPersistentPointer(1, testObj); else return; } testObj.inputValue(1.0, 1.0) ########## TestClass ######### class TestClass{ std::map<float, float> testMap; public: TestClass(); void inputValue(SCStudyInterfaceRef sc, float low, float high); } In an instance method, I insert values into the Map void TestClass::inputValue(SCStudyInterfaceRef sc, float low, float high){ testMap.insert(std::pair<float, float>(low, high)); } Any help is much appreciated. Thank you |
[2021-04-19 02:30:14] |
User641030 - Posts: 13 |
I tried the Sierra remote build and it works fine. It is something to do with my Visual Studio setup. I referred to older messages and documentation and configured my environment based on that. Building remotely would mean I have to copy my individual files to the root of ACS_Source from my project directory. I don't see a way to multi-select files that are inside the sub-folders of ACS_Source. What configuration issue can potentially lead to such problems? |
[2021-04-20 05:54:43] |
Flipper_2 - Posts: 57 |
Not sure if this is your only problem but, https://stackoverflow.com/questions/19164757/why-does-c-have-a-after-a-class-declaration?noredirect=1&lq=1 |
[2021-04-20 18:39:45] |
User641030 - Posts: 13 |
Flipper_2, This is not a syntax issue but a runtime issue. Otherwise, Sierra's remote build wouldn't work.
|
[2021-04-21 06:50:44] |
User907968 - Posts: 833 |
############## Creating object in sc.SetDefaults #################
Don't do this, refer - ACSIL Programming Concepts: Dynamic Memory Allocations Within Study Instance Also read - ACSIL Programming Concepts: Allocating Memory for Classes and testObj.inputValue(1.0, 1.0)
should be testObj->inputValue(1.0, 1.0)
but I guess that might just be a typo in the post. I tried the Sierra remote build and it works fine.
I did read this, but when you buid in VS, why not build for debug and locate the cause of the exception using debugger?
|
[2021-04-25 02:29:48] |
User641030 - Posts: 13 |
testObj.inputValue is typo it is testObj->inputValue. Is there a guide on how to set up VSS for doing builds? I would like to build it like any regular DLL and use it. I'm missing something in the configuration. Any help will be highly appreciated. Thank you! |
[2021-04-25 14:50:26] |
ForgivingComputers.com - Posts: 1012 |
Is there a guide on how to set up VSS for doing builds?
Step-By-Step ACSIL Debugging Important Info Here: Update documentation to support latest version of Visual Studio | Post: 180504 |
To post a message in this thread, you need to log in with your Sierra Chart account: