Support Board
Date/Time: Thu, 09 Jan 2025 19:24:22 +0000
[User Discussion] - header files
View Count: 3248
[2015-04-12 04:57:51] |
dtl-saw - Posts: 79 |
i have a study that compiles in MSVS just fine. Then I add the 3 #includes above the "sierrachart.h" include and I get LNK2019 error. See message below. Can you help me get this to compile? #include <iostream> #include <fstream> #include <string> #include "sierrachart.h" Error 1 error LNK2019: unresolved external symbol __CrtDbgReportW referenced in function "void __cdecl std::_Debug_message(wchar_t const *,wchar_t const *,unsigned int)" (?_Debug_message@std@@YAXPB_W0I@Z) D:\Visual Studio 2012\Projects\dms_Custom_Study_DLL\dms_Custom_Study_DLL\libcpmtd.lib(stdthrow.obj) dms_Custom_Studies |
[2015-04-12 05:01:45] |
dtl-saw - Posts: 79 |
I just noticed that when I change to this //#include <iostream> //#include <fstream> //#include <string> #include "String.h" #include "sierrachart.h" it compiles. It looks like my Visual Studio doesn't have iostream or fstream available to include. Can you tell me how to fix this? thanks |
[2015-04-12 21:06:43] |
dtl-saw - Posts: 79 |
i downloaded and installed msvs2010 sp1 and now it compiles without errors before i was using msvs2012 when it gave errors i don't see a way to remove or delete this post so please close it out as resolved. thanks |
[2015-04-12 21:42:22] |
dtl-saw - Posts: 79 |
Not so fast, I'm still having problems with the compiler and I think you might know how to fix it. If I use "using namespace std" then the compiler recognizes the <iostream>, <fstream>, <string> identifiers but it won't compile error free that way. If I comment out "using namespace std" the compiler does not recognize the <iostream>, <fstream>, <string> identifiers but I get the errors listed below. Am I supposed to be able to get this to compile while using namespace std? #include <iostream> #include <fstream> #include <string> #include "sierrachart.h" //using namespace std; SCDLLName("dms_Custom_Studies") //SCDLLName("SC_dms_custom_studies") SCSFExport scsf_template(SCStudyGraphRef sc) { if (sc.SetDefaults) { // set the configuration and defaults sc.GraphName = "template"; sc.StudyDescription = ""; sc.AutoLoop = 1; // true sc.GraphRegion = 0; sc.FreeDLL = 1; sc.CalculationPrecedence = LOW_PREC_LEVEL; return; } string line; ifstream ifile ("cpp_tst.txt"); if (ifile.is_open()) { while ( getline (ifile,line) ) { cout << line << '\n'; } ifile.close(); } else cout << "Unable to open file"; } gives this build output: <without using namespace std> 1>------ Rebuild All started: Project: SC_dms_custom_studies, Configuration: Debug Win32 ------ 1> exp1.cpp 1>c:\users\owner\documents\visual studio 2010\projects\sc_dms_custom_studies\sc_dms_custom_studies\exp1.cpp(29): error C2065: 'string' : undeclared identifier 1>c:\users\owner\documents\visual studio 2010\projects\sc_dms_custom_studies\sc_dms_custom_studies\exp1.cpp(29): error C2146: syntax error : missing ';' before identifier 'line' 1>c:\users\owner\documents\visual studio 2010\projects\sc_dms_custom_studies\sc_dms_custom_studies\exp1.cpp(29): error C2065: 'line' : undeclared identifier 1>c:\users\owner\documents\visual studio 2010\projects\sc_dms_custom_studies\sc_dms_custom_studies\exp1.cpp(30): error C2065: 'ifstream' : undeclared identifier 1>c:\users\owner\documents\visual studio 2010\projects\sc_dms_custom_studies\sc_dms_custom_studies\exp1.cpp(30): error C2146: syntax error : missing ';' before identifier 'ifile' 1>c:\users\owner\documents\visual studio 2010\projects\sc_dms_custom_studies\sc_dms_custom_studies\exp1.cpp(30): warning C4129: 'c' : unrecognized character escape sequence 1>c:\users\owner\documents\visual studio 2010\projects\sc_dms_custom_studies\sc_dms_custom_studies\exp1.cpp(30): error C3861: 'ifile': identifier not found 1>c:\users\owner\documents\visual studio 2010\projects\sc_dms_custom_studies\sc_dms_custom_studies\exp1.cpp(31): error C2065: 'ifile' : undeclared identifier 1>c:\users\owner\documents\visual studio 2010\projects\sc_dms_custom_studies\sc_dms_custom_studies\exp1.cpp(31): error C2228: left of '.is_open' must have class/struct/union 1> type is ''unknown-type'' 1>c:\users\owner\documents\visual studio 2010\projects\sc_dms_custom_studies\sc_dms_custom_studies\exp1.cpp(33): error C2065: 'ifile' : undeclared identifier 1>c:\users\owner\documents\visual studio 2010\projects\sc_dms_custom_studies\sc_dms_custom_studies\exp1.cpp(33): error C2065: 'line' : undeclared identifier 1>c:\users\owner\documents\visual studio 2010\projects\sc_dms_custom_studies\sc_dms_custom_studies\exp1.cpp(33): error C3861: 'getline': identifier not found 1>c:\users\owner\documents\visual studio 2010\projects\sc_dms_custom_studies\sc_dms_custom_studies\exp1.cpp(35): error C2065: 'cout' : undeclared identifier 1>c:\users\owner\documents\visual studio 2010\projects\sc_dms_custom_studies\sc_dms_custom_studies\exp1.cpp(35): error C2065: 'line' : undeclared identifier 1>c:\users\owner\documents\visual studio 2010\projects\sc_dms_custom_studies\sc_dms_custom_studies\exp1.cpp(37): error C2065: 'ifile' : undeclared identifier 1>c:\users\owner\documents\visual studio 2010\projects\sc_dms_custom_studies\sc_dms_custom_studies\exp1.cpp(37): error C2228: left of '.close' must have class/struct/union 1> type is ''unknown-type'' 1>c:\users\owner\documents\visual studio 2010\projects\sc_dms_custom_studies\sc_dms_custom_studies\exp1.cpp(39): error C2065: 'cout' : undeclared identifier ========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ========== <with using namespace std> 1>------ Build started: Project: SC_dms_custom_studies, Configuration: Debug Win32 ------ 1> exp1.cpp 1> Creating library C:\SierraChart\Data\SC_dms_custom_studies.lib and object C:\SierraChart\Data\SC_dms_custom_studies.exp 1>LINK : warning LNK4098: defaultlib 'LIBCMT' conflicts with use of other libs; use /NODEFAULTLIB:library 1>exp1.obj : error LNK2019: unresolved external symbol __CrtDbgReportW referenced in function "public: char const & __thiscall std::_String_const_iterator<char,struct std::char_traits<char>,class std::allocator<char> >::operator*(void)const " (??D?$_String_const_iterator@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBEABDXZ) 1>libcpmtd.lib(cout.obj) : error LNK2001: unresolved external symbol __CrtDbgReportW 1>libcpmtd.lib(stdthrow.obj) : error LNK2001: unresolved external symbol __CrtDbgReportW 1>exp1.obj : error LNK2019: unresolved external symbol __free_dbg referenced in function "private: void __thiscall std::_Yarn<char>::_Tidy(void)" (?_Tidy@?$_Yarn@D@std@@AAEXXZ) 1>libcpmtd.lib(cout.obj) : error LNK2001: unresolved external symbol __free_dbg 1>libcpmtd.lib(xdebug.obj) : error LNK2001: unresolved external symbol __free_dbg 1>libcpmtd.lib(locale0.obj) : error LNK2001: unresolved external symbol __free_dbg 1>libcpmtd.lib(xdebug.obj) : error LNK2019: unresolved external symbol __malloc_dbg referenced in function "void * __cdecl operator new(unsigned int,struct std::_DebugHeapTag_t const &,char *,int)" (??2@YAPAXIABU_DebugHeapTag_t@std@@PADH@Z) 1>libcpmtd.lib(locale0.obj) : error LNK2001: unresolved external symbol __malloc_dbg 1>libcpmtd.lib(_tolower.obj) : error LNK2019: unresolved external symbol __calloc_dbg referenced in function __Getctype 1>C:\SierraChart\Data\SC_dms_custom_studies.dll : fatal error LNK1120: 4 unresolved externals ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ========== |
[2016-08-09 22:36:50] |
User203925 - Posts: 40 |
Was this issue every solved? I am getting the same error. When I insert #include <iostream> #include <fstream> into my code I receive error LNK2019 and error LKN1120. When I remove the reference to the libraries, the code compiles just fine. I am using MSVS 2013. Any ideas? |
To post a message in this thread, you need to log in with your Sierra Chart account: