VC++ iostream/savefiledialog error - visual-c++

I'm using the SaveFileDialog class example
to combine use create a text file in a user defined directory.
Here's the conflicting part of my code:
private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) {
array<Image^> ^imageArray ;
int CurrentImage=0;
imageArray = gcnew array<Image^>(9);
array<String^>^ names = {L"adc1.bmp" ,"adc2.bmp","adc3.bmp","adc4.bmp","adc5.bmp","adc6.bmp","adc7.bmp","adc8.bmp"};
for(int i=0; i<8; i++)
{
System::ComponentModel::ComponentResourceManager^ resources = (gcnew System::ComponentModel::ComponentResourceManager(Form1::typeid));
imageArray[i] =(cli::safe_cast<System::Drawing::Bitmap^>(resources->GetObject(names[i])));
}
if((this->comboBox4->Text == String::Empty)||(this->textBox2->Text == String::Empty)){
this->textBox1->Text="please select port and save file directory";
}
else{ // start assigning
try{ // first make sure port isn't busy/open
if(!this->serialPort1->IsOpen){
// select the port whose name is in comboBox4 (select port)
this->serialPort1->PortName=this->comboBox4->Text;
//open the port
this->serialPort1->Open();
// sending
String^ name_ = this->serialPort1->PortName;
String^ START;
int m=0;
//send data to setup timer on the microcontroller
this->serialPort1->WriteLine(START);
Stream^ myStream;
SaveFileDialog^ saveFileDialog1 = gcnew SaveFileDialog;
saveFileDialog1->Filter = "txt files (*.txt)|*.txt|All files (*.*)|*.*";
saveFileDialog1->FilterIndex = 2;
saveFileDialog1->RestoreDirectory = true;
if ( saveFileDialog1->ShowDialog() == System::Windows::Forms::DialogResult::OK )
{
if ( (myStream = saveFileDialog1->OpenFile()) != nullptr )
{
// receiving
myStream<<"ADC1;ADC2;ADC3;ADC4;ADC5;ADC6;ADC7;ADC8"<<endl;
while(START){
myStream<<this->serialPort1->ReadLine()<<";";
pictureBox1->image=imagearray[m];
m++;
if(m==7){
myStream<<endl;
m=0;
}
}
}}}
else{
this->textBox1->Text="Warning: port is busy or isn't open";
}
}
catch(UnauthorizedAccessException^){
this->textBox1->Text="Unauthorized access";
}
}
}
However, I'm getting the following errors:
1>------ Build started: Project: Data_Logger, Configuration: Debug Win32 ------
1> Data_Logger.cpp
1>c:\documents and settings\310098394\desktop\programming\visual c++\data_logger\data_logger\Form1.h(301): error C2784: 'std::basic_ostream<_Elem,_Traits> &std::operator <<(std::basic_ostream<_Elem,_Traits> &,const std::error_code &)' : could not deduce template argument for 'std::basic_ostream<_Elem,_Traits> &' from 'System::IO::Stream ^'
1> C:\Program Files\Microsoft Visual Studio 10.0\VC\include\ostream(1085) : see declaration of 'std::operator <<'
1>c:\documents and settings\310098394\desktop\programming\visual c++\data_logger\data_logger\Form1.h(301): error C2784: 'std::basic_ostream<_Elem,_Traits> &std::operator <<(std::basic_ostream<_Elem,_Traits> &&,_Ty)' : could not deduce template argument for 'std::basic_ostream<_Elem,_Traits> &&' from 'System::IO::Stream ^'
1> C:\Program Files\Microsoft Visual Studio 10.0\VC\include\ostream(968) : see declaration of 'std::operator <<'
1>c:\documents and settings\310098394\desktop\programming\visual c++\data_logger\data_logger\Form1.h(301): error C2784: 'std::basic_ostream<char,_Traits> &std::operator <<(std::basic_ostream<char,_Traits> &,unsigned char)' : could not deduce template argument for 'std::basic_ostream<char,_Traits> &' from 'System::IO::Stream ^'
1> C:\Program Files\Microsoft Visual Studio 10.0\VC\include\ostream(958) : see declaration of 'std::operator <<'
1>c:\documents and settings\310098394\desktop\programming\visual c++\data_logger\data_logger\Form1.h(301): error C2784: 'std::basic_ostream<char,_Traits> &std::operator <<(std::basic_ostream<char,_Traits> &,const unsigned char *)' : could not deduce template argument for 'std::basic_ostream<char,_Traits> &' from 'System::IO::Stream ^'
1> C:\Program Files\Microsoft Visual Studio 10.0\VC\include\ostream(951) : see declaration of 'std::operator <<'
1>c:\documents and settings\310098394\desktop\programming\visual c++\data_logger\data_logger\Form1.h(301): error C2784: 'std::basic_ostream<char,_Traits> &std::operator <<(std::basic_ostream<char,_Traits> &,signed char)' : could not deduce template argument for 'std::basic_ostream<char,_Traits> &' from 'System::IO::Stream ^'
1> C:\Program Files\Microsoft Visual Studio 10.0\VC\include\ostream(944) : see declaration of 'std::operator <<'
1>c:\documents and settings\310098394\desktop\programming\visual c++\data_logger\data_logger\Form1.h(301): error C2784: 'std::basic_ostream<char,_Traits> &std::operator <<(std::basic_ostream<char,_Traits> &,const signed char *)' : could not deduce template argument for 'std::basic_ostream<char,_Traits> &' from 'System::IO::Stream ^'
1> C:\Program Files\Microsoft Visual Studio 10.0\VC\include\ostream(937) : see declaration of 'std::operator <<'
1>c:\documents and settings\310098394\desktop\programming\visual c++\data_logger\data_logger\Form1.h(301): error C2784: 'std::basic_ostream<_Elem,_Traits> &std::operator <<(std::basic_ostream<_Elem,_Traits> &,_Elem)' : could not deduce template argument for 'std::basic_ostream<_Elem,_Traits> &' from 'System::IO::Stream ^'
1> C:\Program Files\Microsoft Visual Studio 10.0\VC\include\ostream(898) : see declaration of 'std::operator <<'
1>c:\documents and settings\310098394\desktop\programming\visual c++\data_logger\data_logger\Form1.h(301): error C2784: 'std::basic_ostream<_Elem,_Traits> &std::operator <<(std::basic_ostream<_Elem,_Traits> &,const _Elem *)' : could not deduce template argument for 'std::basic_ostream<_Elem,_Traits> &' from 'System::IO::Stream ^'
1> C:\Program Files\Microsoft Visual Studio 10.0\VC\include\ostream(851) : see declaration of 'std::operator <<'
1>c:\documents and settings\310098394\desktop\programming\visual c++\data_logger\data_logger\Form1.h(301): error C2784: 'std::basic_ostream<char,_Traits> &std::operator <<(std::basic_ostream<char,_Traits> &,char)' : could not deduce template argument for 'std::basic_ostream<char,_Traits> &' from 'System::IO::Stream ^'
1> C:\Program Files\Microsoft Visual Studio 10.0\VC\include\ostream(811) : see declaration of 'std::operator <<'
1>c:\documents and settings\310098394\desktop\programming\visual c++\data_logger\data_logger\Form1.h(301): error C2784: 'std::basic_ostream<char,_Traits> &std::operator <<(std::basic_ostream<char,_Traits> &,const char *)' : could not deduce template argument for 'std::basic_ostream<char,_Traits> &' from 'System::IO::Stream ^'
1> C:\Program Files\Microsoft Visual Studio 10.0\VC\include\ostream(764) : see declaration of 'std::operator <<'
1>c:\documents and settings\310098394\desktop\programming\visual c++\data_logger\data_logger\Form1.h(301): error C2784: 'std::basic_ostream<_Elem,_Traits> &std::operator <<(std::basic_ostream<_Elem,_Traits> &,char)' : could not deduce template argument for 'std::basic_ostream<_Elem,_Traits> &' from 'System::IO::Stream ^'
1> C:\Program Files\Microsoft Visual Studio 10.0\VC\include\ostream(726) : see declaration of 'std::operator <<'
1>c:\documents and settings\310098394\desktop\programming\visual c++\data_logger\data_logger\Form1.h(301): error C2784: 'std::basic_ostream<_Elem,_Traits> &std::operator <<(std::basic_ostream<_Elem,_Traits> &,const char *)' : could not deduce template argument for 'std::basic_ostream<_Elem,_Traits> &' from 'System::IO::Stream ^'
1> C:\Program Files\Microsoft Visual Studio 10.0\VC\include\ostream(679) : see declaration of 'std::operator <<'
1>c:\documents and settings\310098394\desktop\programming\visual c++\data_logger\data_logger\Form1.h(301): error C2676: binary '<<' : 'System::IO::Stream ^' does not define this operator or a conversion to a type acceptable to the predefined operator
1>c:\documents and settings\310098394\desktop\programming\visual c++\data_logger\data_logger\Form1.h(304): error C2784: 'std::basic_ostream<_Elem,_Traits> &std::operator <<(std::basic_ostream<_Elem,_Traits> &,const std::error_code &)' : could not deduce template argument for 'std::basic_ostream<_Elem,_Traits> &' from 'System::IO::Stream ^'
1> C:\Program Files\Microsoft Visual Studio 10.0\VC\include\ostream(1085) : see declaration of 'std::operator <<'
1>c:\documents and settings\310098394\desktop\programming\visual c++\data_logger\data_logger\Form1.h(304): error C2784: 'std::basic_ostream<_Elem,_Traits> &std::operator <<(std::basic_ostream<_Elem,_Traits> &&,_Ty)' : could not deduce template argument for 'std::basic_ostream<_Elem,_Traits> &&' from 'System::IO::Stream ^'
1> C:\Program Files\Microsoft Visual Studio 10.0\VC\include\ostream(968) : see declaration of 'std::operator <<'
1>c:\documents and settings\310098394\desktop\programming\visual c++\data_logger\data_logger\Form1.h(304): error C2784: 'std::basic_ostream<char,_Traits> &std::operator <<(std::basic_ostream<char,_Traits> &,unsigned char)' : could not deduce template argument for 'std::basic_ostream<char,_Traits> &' from 'System::IO::Stream ^'
1> C:\Program Files\Microsoft Visual Studio 10.0\VC\include\ostream(958) : see declaration of 'std::operator <<'
1>c:\documents and settings\310098394\desktop\programming\visual c++\data_logger\data_logger\Form1.h(304): error C2784: 'std::basic_ostream<char,_Traits> &std::operator <<(std::basic_ostream<char,_Traits> &,const unsigned char *)' : could not deduce template argument for 'std::basic_ostream<char,_Traits> &' from 'System::IO::Stream ^'
1> C:\Program Files\Microsoft Visual Studio 10.0\VC\include\ostream(951) : see declaration of 'std::operator <<'
1>c:\documents and settings\310098394\desktop\programming\visual c++\data_logger\data_logger\Form1.h(304): error C2784: 'std::basic_ostream<char,_Traits> &std::operator <<(std::basic_ostream<char,_Traits> &,signed char)' : could not deduce template argument for 'std::basic_ostream<char,_Traits> &' from 'System::IO::Stream ^'
1> C:\Program Files\Microsoft Visual Studio 10.0\VC\include\ostream(944) : see declaration of 'std::operator <<'
1>c:\documents and settings\310098394\desktop\programming\visual c++\data_logger\data_logger\Form1.h(304): error C2784: 'std::basic_ostream<char,_Traits> &std::operator <<(std::basic_ostream<char,_Traits> &,const signed char *)' : could not deduce template argument for 'std::basic_ostream<char,_Traits> &' from 'System::IO::Stream ^'
1> C:\Program Files\Microsoft Visual Studio 10.0\VC\include\ostream(937) : see declaration of 'std::operator <<'
1>c:\documents and settings\310098394\desktop\programming\visual c++\data_logger\data_logger\Form1.h(304): error C2784: 'std::basic_ostream<_Elem,_Traits> &std::operator <<(std::basic_ostream<_Elem,_Traits> &,_Elem)' : could not deduce template argument for 'std::basic_ostream<_Elem,_Traits> &' from 'System::IO::Stream ^'
1> C:\Program Files\Microsoft Visual Studio 10.0\VC\include\ostream(898) : see declaration of 'std::operator <<'
1>c:\documents and settings\310098394\desktop\programming\visual c++\data_logger\data_logger\Form1.h(304): error C2784: 'std::basic_ostream<_Elem,_Traits> &std::operator <<(std::basic_ostream<_Elem,_Traits> &,const _Elem *)' : could not deduce template argument for 'std::basic_ostream<_Elem,_Traits> &' from 'System::IO::Stream ^'
1> C:\Program Files\Microsoft Visual Studio 10.0\VC\include\ostream(851) : see declaration of 'std::operator <<'
1>c:\documents and settings\310098394\desktop\programming\visual c++\data_logger\data_logger\Form1.h(304): error C2784: 'std::basic_ostream<char,_Traits> &std::operator <<(std::basic_ostream<char,_Traits> &,char)' : could not deduce template argument for 'std::basic_ostream<char,_Traits> &' from 'System::IO::Stream ^'
1> C:\Program Files\Microsoft Visual Studio 10.0\VC\include\ostream(811) : see declaration of 'std::operator <<'
1>c:\documents and settings\310098394\desktop\programming\visual c++\data_logger\data_logger\Form1.h(304): error C2784: 'std::basic_ostream<char,_Traits> &std::operator <<(std::basic_ostream<char,_Traits> &,const char *)' : could not deduce template argument for 'std::basic_ostream<char,_Traits> &' from 'System::IO::Stream ^'
1> C:\Program Files\Microsoft Visual Studio 10.0\VC\include\ostream(764) : see declaration of 'std::operator <<'
1>c:\documents and settings\310098394\desktop\programming\visual c++\data_logger\data_logger\Form1.h(304): error C2784: 'std::basic_ostream<_Elem,_Traits> &std::operator <<(std::basic_ostream<_Elem,_Traits> &,char)' : could not deduce template argument for 'std::basic_ostream<_Elem,_Traits> &' from 'System::IO::Stream ^'
1> C:\Program Files\Microsoft Visual Studio 10.0\VC\include\ostream(726) : see declaration of 'std::operator <<'
1>c:\documents and settings\310098394\desktop\programming\visual c++\data_logger\data_logger\Form1.h(304): error C2784: 'std::basic_ostream<_Elem,_Traits> &std::operator <<(std::basic_ostream<_Elem,_Traits> &,const char *)' : could not deduce template argument for 'std::basic_ostream<_Elem,_Traits> &' from 'System::IO::Stream ^'
1> C:\Program Files\Microsoft Visual Studio 10.0\VC\include\ostream(679) : see declaration of 'std::operator <<'
1>c:\documents and settings\310098394\desktop\programming\visual c++\data_logger\data_logger\Form1.h(304): error C2676: binary '<<' : 'System::IO::Stream ^' does not define this operator or a conversion to a type acceptable to the predefined operator
1>c:\documents and settings\310098394\desktop\programming\visual c++\data_logger\data_logger\Form1.h(305): error C2039: 'image' : is not a member of 'System::Windows::Forms::PictureBox'
1> c:\program files\reference assemblies\microsoft\framework\.netframework\v4.0\system.windows.forms.dll : see declaration of 'System::Windows::Forms::PictureBox'
1>c:\documents and settings\310098394\desktop\programming\visual c++\data_logger\data_logger\Form1.h(305): error C2065: 'imagearray' : undeclared identifier
1>c:\documents and settings\310098394\desktop\programming\visual c++\data_logger\data_logger\Form1.h(308): error C2784: 'std::basic_ostream<_Elem,_Traits> &std::operator <<(std::basic_ostream<_Elem,_Traits> &,const std::error_code &)' : could not deduce template argument for 'std::basic_ostream<_Elem,_Traits> &' from 'System::IO::Stream ^'
1> C:\Program Files\Microsoft Visual Studio 10.0\VC\include\ostream(1085) : see declaration of 'std::operator <<'
1>c:\documents and settings\310098394\desktop\programming\visual c++\data_logger\data_logger\Form1.h(308): error C2784: 'std::basic_ostream<_Elem,_Traits> &std::operator <<(std::basic_ostream<_Elem,_Traits> &&,_Ty)' : could not deduce template argument for 'std::basic_ostream<_Elem,_Traits> &&' from 'System::IO::Stream ^'
1> C:\Program Files\Microsoft Visual Studio 10.0\VC\include\ostream(968) : see declaration of 'std::operator <<'
1>c:\documents and settings\310098394\desktop\programming\visual c++\data_logger\data_logger\Form1.h(308): error C2784: 'std::basic_ostream<char,_Traits> &std::operator <<(std::basic_ostream<char,_Traits> &,unsigned char)' : could not deduce template argument for 'std::basic_ostream<char,_Traits> &' from 'System::IO::Stream ^'
1> C:\Program Files\Microsoft Visual Studio 10.0\VC\include\ostream(958) : see declaration of 'std::operator <<'
1>c:\documents and settings\310098394\desktop\programming\visual c++\data_logger\data_logger\Form1.h(308): error C2784: 'std::basic_ostream<char,_Traits> &std::operator <<(std::basic_ostream<char,_Traits> &,const unsigned char *)' : could not deduce template argument for 'std::basic_ostream<char,_Traits> &' from 'System::IO::Stream ^'
1> C:\Program Files\Microsoft Visual Studio 10.0\VC\include\ostream(951) : see declaration of 'std::operator <<'
1>c:\documents and settings\310098394\desktop\programming\visual c++\data_logger\data_logger\Form1.h(308): error C2784: 'std::basic_ostream<char,_Traits> &std::operator <<(std::basic_ostream<char,_Traits> &,signed char)' : could not deduce template argument for 'std::basic_ostream<char,_Traits> &' from 'System::IO::Stream ^'
1> C:\Program Files\Microsoft Visual Studio 10.0\VC\include\ostream(944) : see declaration of 'std::operator <<'
1>c:\documents and settings\310098394\desktop\programming\visual c++\data_logger\data_logger\Form1.h(308): error C2784: 'std::basic_ostream<char,_Traits> &std::operator <<(std::basic_ostream<char,_Traits> &,const signed char *)' : could not deduce template argument for 'std::basic_ostream<char,_Traits> &' from 'System::IO::Stream ^'
1> C:\Program Files\Microsoft Visual Studio 10.0\VC\include\ostream(937) : see declaration of 'std::operator <<'
1>c:\documents and settings\310098394\desktop\programming\visual c++\data_logger\data_logger\Form1.h(308): error C2784: 'std::basic_ostream<_Elem,_Traits> &std::operator <<(std::basic_ostream<_Elem,_Traits> &,_Elem)' : could not deduce template argument for 'std::basic_ostream<_Elem,_Traits> &' from 'System::IO::Stream ^'
1> C:\Program Files\Microsoft Visual Studio 10.0\VC\include\ostream(898) : see declaration of 'std::operator <<'
1>c:\documents and settings\310098394\desktop\programming\visual c++\data_logger\data_logger\Form1.h(308): error C2784: 'std::basic_ostream<_Elem,_Traits> &std::operator <<(std::basic_ostream<_Elem,_Traits> &,const _Elem *)' : could not deduce template argument for 'std::basic_ostream<_Elem,_Traits> &' from 'System::IO::Stream ^'
1> C:\Program Files\Microsoft Visual Studio 10.0\VC\include\ostream(851) : see declaration of 'std::operator <<'
1>c:\documents and settings\310098394\desktop\programming\visual c++\data_logger\data_logger\Form1.h(308): error C2784: 'std::basic_ostream<char,_Traits> &std::operator <<(std::basic_ostream<char,_Traits> &,char)' : could not deduce template argument for 'std::basic_ostream<char,_Traits> &' from 'System::IO::Stream ^'
1> C:\Program Files\Microsoft Visual Studio 10.0\VC\include\ostream(811) : see declaration of 'std::operator <<'
1>c:\documents and settings\310098394\desktop\programming\visual c++\data_logger\data_logger\Form1.h(308): error C2784: 'std::basic_ostream<char,_Traits> &std::operator <<(std::basic_ostream<char,_Traits> &,const char *)' : could not deduce template argument for 'std::basic_ostream<char,_Traits> &' from 'System::IO::Stream ^'
1> C:\Program Files\Microsoft Visual Studio 10.0\VC\include\ostream(764) : see declaration of 'std::operator <<'
1>c:\documents and settings\310098394\desktop\programming\visual c++\data_logger\data_logger\Form1.h(308): error C2784: 'std::basic_ostream<_Elem,_Traits> &std::operator <<(std::basic_ostream<_Elem,_Traits> &,char)' : could not deduce template argument for 'std::basic_ostream<_Elem,_Traits> &' from 'System::IO::Stream ^'
1> C:\Program Files\Microsoft Visual Studio 10.0\VC\include\ostream(726) : see declaration of 'std::operator <<'
1>c:\documents and settings\310098394\desktop\programming\visual c++\data_logger\data_logger\Form1.h(308): error C2784: 'std::basic_ostream<_Elem,_Traits> &std::operator <<(std::basic_ostream<_Elem,_Traits> &,const char *)' : could not deduce template argument for 'std::basic_ostream<_Elem,_Traits> &' from 'System::IO::Stream ^'
1> C:\Program Files\Microsoft Visual Studio 10.0\VC\include\ostream(679) : see declaration of 'std::operator <<'
1>c:\documents and settings\310098394\desktop\programming\visual c++\data_logger\data_logger\Form1.h(308): error C2676: binary '<<' : 'System::IO::Stream ^' does not define this operator or a conversion to a type acceptable to the predefined operator
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
The error starts at line: myStream<<"ADC1;ADC2;ADC3;ADC4;ADC5;ADC6;ADC7;ADC8"<<endl;
I used ofstream before and it worked. However, I would like the user to select the directory and name the output file and I'm not sure if that would be possible using ofstream. I would really appreciate it, if someone could help me solve at the least the error related to myStream.
Thanks in advance

System::IO::Stream doesn't support operator<< and operator>> like std::[i|o|io]stream. To write to a System::IO::Stream, use the Stream::Write method.
Check out the documentation for System::IO::Stream:
http://msdn.microsoft.com/en-us/library/system.io.stream.aspx

Related

CMapStringToString vs std::map<CString, CString>

Are there any real benefits for me to migrate my useage of CMapStringToString over to std::map<CString, CString> in my application?
I don't understand, I tried to change the code and now it won't compile:
7>------ Build started: Project: Meeting Schedule Assistant, Configuration: Release x64 ------
7>CalendarSettingsOutlookPage.cpp
7>C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.30.30705\include\xhash(112,53): error C2064: term does not evaluate to a function taking 1 arguments
7>C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.30.30705\include\xhash(135): message : see reference to variable template 'const bool _Nothrow_hash<std::hash<ATL::CStringT<wchar_t,StrTraitMFC_DLL<wchar_t,ATL::ChTraitsCRT<wchar_t> > > >,ATL::CStringT<wchar_t,StrTraitMFC_DLL<wchar_t,ATL::ChTraitsCRT<wchar_t> > > >' being compiled
7>C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.30.30705\include\xhash(135): message : while compiling class template member function 'size_t std::_Uhash_compare<_Kty,_Hasher,_Keyeq>::operator ()<_Kty>(const _Keyty &) noexcept(<expr>) const'
7> with
7> [
7> _Kty=CString,
7> _Hasher=std::hash<CString>,
7> _Keyeq=std::equal_to<CString>,
7> _Keyty=ATL::CStringT<wchar_t,StrTraitMFC_DLL<wchar_t,ATL::ChTraitsCRT<wchar_t>>>
7> ]
7>C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.30.30705\include\xhash(1109): message : see reference to variable template 'const bool _Nothrow_hash<std::_Umap_traits<ATL::CStringT<wchar_t,StrTraitMFC_DLL<wchar_t,ATL::ChTraitsCRT<wchar_t> > >,ATL::CStringT<wchar_t,StrTraitMFC_DLL<wchar_t,ATL::ChTraitsCRT<wchar_t> > >,std::_Uhash_compare<ATL::CStringT<wchar_t,StrTraitMFC_DLL<wchar_t,ATL::ChTraitsCRT<wchar_t> > >,std::hash<ATL::CStringT<wchar_t,StrTraitMFC_DLL<wchar_t,ATL::ChTraitsCRT<wchar_t> > > >,std::equal_to<ATL::CStringT<wchar_t,StrTraitMFC_DLL<wchar_t,ATL::ChTraitsCRT<wchar_t> > > > >,std::allocator<std::pair<ATL::CStringT<wchar_t,StrTraitMFC_DLL<wchar_t,ATL::ChTraitsCRT<wchar_t> > > const ,ATL::CStringT<wchar_t,StrTraitMFC_DLL<wchar_t,ATL::ChTraitsCRT<wchar_t> > > > >,0>,ATL::CStringT<wchar_t,StrTraitMFC_DLL<wchar_t,ATL::ChTraitsCRT<wchar_t> > > >' being compiled
7>C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.30.30705\include\xhash(1096): message : while compiling class template member function 'void std::_Hash<std::_Umap_traits<_Kty,_Ty,std::_Uhash_compare<_Kty,_Hasher,_Keyeq>,_Alloc,false>>::clear(void) noexcept'
7> with
7> [
7> _Kty=CString,
7> _Ty=CString,
7> _Hasher=std::hash<CString>,
7> _Keyeq=std::equal_to<CString>,
7> _Alloc=std::allocator<std::pair<const CString,CString>>
7> ]
7>D:\My Programs\2022\MeetSchedAssist\Meeting Schedule Assistant\CalendarSettingsOutlookPage.cpp(156): message : see reference to function template instantiation 'void std::_Hash<std::_Umap_traits<_Kty,_Ty,std::_Uhash_compare<_Kty,_Hasher,_Keyeq>,_Alloc,false>>::clear(void) noexcept' being compiled
7> with
7> [
7> _Kty=CString,
7> _Ty=CString,
7> _Hasher=std::hash<CString>,
7> _Keyeq=std::equal_to<CString>,
7> _Alloc=std::allocator<std::pair<const CString,CString>>
7> ]
7>C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.30.30705\include\unordered_map(67): message : see reference to class template instantiation 'std::_Hash<std::_Umap_traits<_Kty,_Ty,std::_Uhash_compare<_Kty,_Hasher,_Keyeq>,_Alloc,false>>' being compiled
7> with
7> [
7> _Kty=CString,
7> _Ty=CString,
7> _Hasher=std::hash<CString>,
7> _Keyeq=std::equal_to<CString>,
7> _Alloc=std::allocator<std::pair<const CString,CString>>
7> ]
7>D:\My Programs\2022\MeetSchedAssist\Meeting Schedule Assistant\CalendarSettingsOutlookPage.h(59): message : see reference to class template instantiation 'std::unordered_map<CString,CString,std::hash<CString>,std::equal_to<CString>,std::allocator<std::pair<const CString,CString>>>' being compiled
7>C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.30.30705\include\xhash(111,44): error C2056: illegal expression
7>Done building project "Meeting Schedule Assistant.vcxproj" -- FAILED.
If I use std::map<CString, CString> it works but std::unordered_map<CString, CString> throws out the errors above. My usage calls:
if (m_mapCalendarList.find(strCalendarName) != m_mapCalendarList.end())
if (strCalendarId == m_mapCalendarList[strCalendarName])
m_mapCalendarList.clear();
The variable is defined in the header.
MFC hash maps have some drawbacks, except from just being not C++ Standard and not portable:
Do not recalculate hash table automatically. Not even able to resize hash table when populated. Default size of hash table may be suboptimal for you.
As noted in comments, they don't support range-based for, or ranges algorithm
Not copyable and not movable by themselves. Moving a container may be useful
Don't support move semantic for element insertion, this involves some overhead
For std::unordered_map, you need to implement hash function, and pass it as the corresponding template parameter. Or specialize standard hash for CString. But I prefer the former option.
And would be good to pass also comparison function, that performs locale-independent comparison. Since with a hash that is not aware of locale, you can't have locale-aware map anyway, but CString::operator== is locale-aware.
As there's HashKey that can take LPCSTR and LPCWSTR that is used by CMap, implementation of own STL-compatible hashes is trivial.
You can completely avoid dealing with hashes, and use std::unordered_map<std::string, std::string>. But transition to std::string will cause way more changes I guess.

node.js - unable to install tcpsocket-serialport

I'm currently trying to set up my ESP8266 with Johnny Five wirelessly via node.js. To do this I need to get a virtual Serial Port via TCP. I found a very promising node-module but i just can't get it to install. I've been browsing the web for quite some time now. I installed the windows 8.1 SDK including c++ compiler, the windows build tools, node-gyp (which was basically the reason for all the other stuff) but now I'm completely stuck as I don't know what to make of the errors.
This is where I got the pacakage from
https://github.com/sizuhiko/tcpsocket-serialport
These are the errors (sorry for the mess)
Die Projekte in dieser Projektmappe werden nacheinander erstellt. Um eine parallele Erstellung zu ermöglichen, müssen Sie den Schalter "/m" hinzufügen.
serialport.cpp
serialport_win.cpp
enumser.cpp
win_delay_load_hook.cc
..\src\win\enumser.cpp(443): warning C4996: 'GetVersionExA': was declared deprecated [C:\Users\chris\OneDrive\P
rogrammieren\Code\arduino\jf\test2\tcpsocket-serialport\node_modules\johnny-five\node_modules\serialport\build\
serialport.vcxproj]
C:\Program Files (x86)\Windows Kits\8.1\Include\um\sysinfoapi.h(433): note: see declaration of 'GetVersionExA
'
C:\Users\chris\OneDrive\Programmieren\Code\arduino\jf\test2\tcpsocket-serialport\node_modules\johnny-five\node_
modules\nan\nan.h(263): error C2995: 'v8::Local<T> _NanEnsureLocal(v8::Local<T>)': function template has alread
y been defined (compiling source file ..\src\serialport.cpp) [C:\Users\chris\OneDrive\Programmieren\Code\arduin
o\jf\test2\tcpsocket-serialport\node_modules\johnny-five\node_modules\serialport\build\serialport.vcxproj]
C:\Users\chris\OneDrive\Programmieren\Code\arduino\jf\test2\tcpsocket-serialport\node_modules\johnny-five\nod
e_modules\nan\nan.h(256): note: see declaration of '_NanEnsureLocal' (compiling source file ..\src\serialport
.cpp)
c:\users\chris\onedrive\programmieren\code\arduino\jf\test2\tcpsocket-serialport\node_modules\johnny-five\node_
modules\serialport\src\win\stdstring.h(2123): warning C4311: 'reinterpret_cast': pointer truncation from 'const
void *' to 'unsigned long' (compiling source file ..\src\win\enumser.cpp) [C:\Users\chris\OneDrive\Programmier
en\Code\arduino\jf\test2\tcpsocket-serialport\node_modules\johnny-five\node_modules\serialport\build\serialport
.vcxproj]
c:\users\chris\onedrive\programmieren\code\arduino\jf\test2\tcpsocket-serialport\node_modules\johnny-five\nod
e_modules\serialport\src\win\stdstring.h(2117): note: while compiling class template member function 'bool CS
tdStr<wchar_t>::TryLoad(const void *)' (compiling source file ..\src\win\enumser.cpp)
c:\users\chris\onedrive\programmieren\code\arduino\jf\test2\tcpsocket-serialport\node_modules\johnny-five\nod
e_modules\serialport\src\win\stdstring.h(2171): note: see reference to function template instantiation 'bool
CStdStr<wchar_t>::TryLoad(const void *)' being compiled (compiling source file ..\src\win\enumser.cpp)
c:\users\chris\onedrive\programmieren\code\arduino\jf\test2\tcpsocket-serialport\node_modules\johnny-five\nod
e_modules\serialport\src\win\stdstring.h(3982): note: see reference to class template instantiation 'CStdStr<
wchar_t>' being compiled (compiling source file ..\src\win\enumser.cpp)
c:\users\chris\onedrive\programmieren\code\arduino\jf\test2\tcpsocket-serialport\node_modules\johnny-five\node_
modules\serialport\src\win\stdstring.h(2123): warning C4302: 'reinterpret_cast': truncation from 'const void *'
to 'unsigned long' (compiling source file ..\src\win\enumser.cpp) [C:\Users\chris\OneDrive\Programmieren\Code\
arduino\jf\test2\tcpsocket-serialport\node_modules\johnny-five\node_modules\serialport\build\serialport.vcxproj
]
c:\users\chris\onedrive\programmieren\code\arduino\jf\test2\tcpsocket-serialport\node_modules\johnny-five\node_
modules\serialport\src\win\stdstring.h(2126): warning C4311: 'reinterpret_cast': pointer truncation from 'const
void *' to 'unsigned long' (compiling source file ..\src\win\enumser.cpp) [C:\Users\chris\OneDrive\Programmier
en\Code\arduino\jf\test2\tcpsocket-serialport\node_modules\johnny-five\node_modules\serialport\build\serialport
.vcxproj]
c:\users\chris\onedrive\programmieren\code\arduino\jf\test2\tcpsocket-serialport\node_modules\johnny-five\node_
modules\serialport\src\win\stdstring.h(2126): warning C4302: 'reinterpret_cast': truncation from 'const void *'
to 'unsigned long' (compiling source file ..\src\win\enumser.cpp) [C:\Users\chris\OneDrive\Programmieren\Code\
arduino\jf\test2\tcpsocket-serialport\node_modules\johnny-five\node_modules\serialport\build\serialport.vcxproj
]
C:\Users\chris\OneDrive\Programmieren\Code\arduino\jf\test2\tcpsocket-serialport\node_modules\johnny-five\node_
modules\nan\nan.h(661): error C3083: 'smalloc': the symbol to the left of a '::' must be a type (compiling sour
ce file ..\src\serialport.cpp) [C:\Users\chris\OneDrive\Programmieren\Code\arduino\jf\test2\tcpsocket-serialpor
t\node_modules\johnny-five\node_modules\serialport\build\serialport.vcxproj]
C:\Users\chris\OneDrive\Programmieren\Code\arduino\jf\test2\tcpsocket-serialport\node_modules\johnny-five\node_
modules\nan\nan.h(661): error C2039: 'FreeCallback': is not a member of 'node' (compiling source file ..\src\se
rialport.cpp) [C:\Users\chris\OneDrive\Programmieren\Code\arduino\jf\test2\tcpsocket-serialport\node_modules\jo
hnny-five\node_modules\serialport\build\serialport.vcxproj]
C:\Users\chris\.node-gyp\4.6.1\include\node\node_object_wrap.h(8): note: see declaration of 'node' (compiling
source file ..\src\serialport.cpp)
C:\Users\chris\OneDrive\Programmieren\Code\arduino\jf\test2\tcpsocket-serialport\node_modules\johnny-five\node_
modules\nan\nan.h(661): error C2061: syntax error: identifier 'FreeCallback' (compiling source file ..\src\seri
alport.cpp) [C:\Users\chris\OneDrive\Programmieren\Code\arduino\jf\test2\tcpsocket-serialport\node_modules\john
ny-five\node_modules\serialport\build\serialport.vcxproj]
C:\Users\chris\OneDrive\Programmieren\Code\arduino\jf\test2\tcpsocket-serialport\node_modules\johnny-five\node_
modules\nan\nan.h(665): error C2065: 'callback': undeclared identifier (compiling source file ..\src\serialport
.cpp) [C:\Users\chris\OneDrive\Programmieren\Code\arduino\jf\test2\tcpsocket-serialport\node_modules\johnny-fiv
e\node_modules\serialport\build\serialport.vcxproj]
C:\Users\chris\OneDrive\Programmieren\Code\arduino\jf\test2\tcpsocket-serialport\node_modules\johnny-five\node_
modules\nan\nan.h(665): error C2065: 'hint': undeclared identifier (compiling source file ..\src\serialport.cpp
) [C:\Users\chris\OneDrive\Programmieren\Code\arduino\jf\test2\tcpsocket-serialport\node_modules\johnny-five\no
de_modules\serialport\build\serialport.vcxproj]
C:\Users\chris\OneDrive\Programmieren\Code\arduino\jf\test2\tcpsocket-serialport\node_modules\johnny-five\node_
modules\nan\nan.h(672): error C2665: 'node::Buffer::New': none of the 4 overloads could convert all the argumen
t types (compiling source file ..\src\serialport.cpp) [C:\Users\chris\OneDrive\Programmieren\Code\arduino\jf\te
st2\tcpsocket-serialport\node_modules\johnny-five\node_modules\serialport\build\serialport.vcxproj]
C:\Users\chris\.node-gyp\4.6.1\include\node\node_buffer.h(46): note: could be 'v8::MaybeLocal<v8::Object> nod
e::Buffer::New(v8::Isolate *,char *,std::size_t)' (compiling source file ..\src\serialport.cpp)
C:\Users\chris\.node-gyp\4.6.1\include\node\node_buffer.h(34): note: or 'v8::MaybeLocal<v8::Object> nod
e::Buffer::New(v8::Isolate *,v8::Local<v8::String>,node::encoding)' (compiling source file ..\src\serialport.
cpp)
C:\Users\chris\OneDrive\Programmieren\Code\arduino\jf\test2\tcpsocket-serialport\node_modules\johnny-five\nod
e_modules\nan\nan.h(672): note: while trying to match the argument list '(v8::Isolate *, const char *, uint32
_t)' (compiling source file ..\src\serialport.cpp)
C:\Users\chris\OneDrive\Programmieren\Code\arduino\jf\test2\tcpsocket-serialport\node_modules\johnny-five\node_
modules\nan\nan.h(676): error C2440: 'return': cannot convert from 'v8::MaybeLocal<v8::Object>' to 'v8::Local<v
8::Object>' (compiling source file ..\src\serialport.cpp) [C:\Users\chris\OneDrive\Programmieren\Code\arduino\j
f\test2\tcpsocket-serialport\node_modules\johnny-five\node_modules\serialport\build\serialport.vcxproj]
C:\Users\chris\OneDrive\Programmieren\Code\arduino\jf\test2\tcpsocket-serialport\node_modules\johnny-five\nod
e_modules\nan\nan.h(676): note: No constructor could take the source type, or constructor overload resolution
was ambiguous (compiling source file ..\src\serialport.cpp)
C:\Users\chris\OneDrive\Programmieren\Code\arduino\jf\test2\tcpsocket-serialport\node_modules\johnny-five\node_
modules\nan\nan.h(683): error C2039: 'Use': is not a member of 'node::Buffer' (compiling source file ..\src\ser
ialport.cpp) [C:\Users\chris\OneDrive\Programmieren\Code\arduino\jf\test2\tcpsocket-serialport\node_modules\joh
nny-five\node_modules\serialport\build\serialport.vcxproj]
C:\Users\chris\.node-gyp\4.6.1\include\node\node_buffer.h(11): note: see declaration of 'node::Buffer' (compi
ling source file ..\src\serialport.cpp)
C:\Users\chris\OneDrive\Programmieren\Code\arduino\jf\test2\tcpsocket-serialport\node_modules\johnny-five\node_
modules\nan\nan.h(683): error C3861: 'Use': identifier not found (compiling source file ..\src\serialport.cpp)
[C:\Users\chris\OneDrive\Programmieren\Code\arduino\jf\test2\tcpsocket-serialport\node_modules\johnny-five\node
_modules\serialport\build\serialport.vcxproj]
C:\Users\chris\OneDrive\Programmieren\Code\arduino\jf\test2\tcpsocket-serialport\node_modules\johnny-five\node_
modules\nan\nan.h(263): error C2995: 'v8::Local<T> _NanEnsureLocal(v8::Local<T>)': function template has alread
y been defined (compiling source file ..\src\serialport_win.cpp) [C:\Users\chris\OneDrive\Programmieren\Code\ar
duino\jf\test2\tcpsocket-serialport\node_modules\johnny-five\node_modules\serialport\build\serialport.vcxproj]
C:\Users\chris\OneDrive\Programmieren\Code\arduino\jf\test2\tcpsocket-serialport\node_modules\johnny-five\nod
e_modules\nan\nan.h(256): note: see declaration of '_NanEnsureLocal' (compiling source file ..\src\serialport
_win.cpp)
C:\Users\chris\OneDrive\Programmieren\Code\arduino\jf\test2\tcpsocket-serialport\node_modules\johnny-five\node_
modules\nan\nan.h(661): error C3083: 'smalloc': the symbol to the left of a '::' must be a type (compiling sour
ce file ..\src\serialport_win.cpp) [C:\Users\chris\OneDrive\Programmieren\Code\arduino\jf\test2\tcpsocket-seria
lport\node_modules\johnny-five\node_modules\serialport\build\serialport.vcxproj]
C:\Users\chris\OneDrive\Programmieren\Code\arduino\jf\test2\tcpsocket-serialport\node_modules\johnny-five\node_
modules\nan\nan.h(661): error C2039: 'FreeCallback': is not a member of 'node' (compiling source file ..\src\se
rialport_win.cpp) [C:\Users\chris\OneDrive\Programmieren\Code\arduino\jf\test2\tcpsocket-serialport\node_module
s\johnny-five\node_modules\serialport\build\serialport.vcxproj]
C:\Users\chris\.node-gyp\4.6.1\include\node\node_object_wrap.h(8): note: see declaration of 'node' (compiling
source file ..\src\serialport_win.cpp)
C:\Users\chris\OneDrive\Programmieren\Code\arduino\jf\test2\tcpsocket-serialport\node_modules\johnny-five\node_
modules\nan\nan.h(661): error C2061: syntax error: identifier 'FreeCallback' (compiling source file ..\src\seri
alport_win.cpp) [C:\Users\chris\OneDrive\Programmieren\Code\arduino\jf\test2\tcpsocket-serialport\node_modules\
johnny-five\node_modules\serialport\build\serialport.vcxproj]
C:\Users\chris\OneDrive\Programmieren\Code\arduino\jf\test2\tcpsocket-serialport\node_modules\johnny-five\node_
modules\nan\nan.h(665): error C2065: 'callback': undeclared identifier (compiling source file ..\src\serialport
_win.cpp) [C:\Users\chris\OneDrive\Programmieren\Code\arduino\jf\test2\tcpsocket-serialport\node_modules\johnny
-five\node_modules\serialport\build\serialport.vcxproj]
C:\Users\chris\OneDrive\Programmieren\Code\arduino\jf\test2\tcpsocket-serialport\node_modules\johnny-five\node_
modules\nan\nan.h(665): error C2065: 'hint': undeclared identifier (compiling source file ..\src\serialport_win
.cpp) [C:\Users\chris\OneDrive\Programmieren\Code\arduino\jf\test2\tcpsocket-serialport\node_modules\johnny-fiv
e\node_modules\serialport\build\serialport.vcxproj]
C:\Users\chris\OneDrive\Programmieren\Code\arduino\jf\test2\tcpsocket-serialport\node_modules\johnny-five\node_
modules\nan\nan.h(672): error C2665: 'node::Buffer::New': none of the 4 overloads could convert all the argumen
t types (compiling source file ..\src\serialport_win.cpp) [C:\Users\chris\OneDrive\Programmieren\Code\arduino\j
f\test2\tcpsocket-serialport\node_modules\johnny-five\node_modules\serialport\build\serialport.vcxproj]
C:\Users\chris\.node-gyp\4.6.1\include\node\node_buffer.h(46): note: could be 'v8::MaybeLocal<v8::Object> nod
e::Buffer::New(v8::Isolate *,char *,std::size_t)' (compiling source file ..\src\serialport_win.cpp)
C:\Users\chris\.node-gyp\4.6.1\include\node\node_buffer.h(34): note: or 'v8::MaybeLocal<v8::Object> nod
e::Buffer::New(v8::Isolate *,v8::Local<v8::String>,node::encoding)' (compiling source file ..\src\serialport_
win.cpp)
C:\Users\chris\OneDrive\Programmieren\Code\arduino\jf\test2\tcpsocket-serialport\node_modules\johnny-five\nod
e_modules\nan\nan.h(672): note: while trying to match the argument list '(v8::Isolate *, const char *, uint32
_t)' (compiling source file ..\src\serialport_win.cpp)
C:\Users\chris\OneDrive\Programmieren\Code\arduino\jf\test2\tcpsocket-serialport\node_modules\johnny-five\node_
modules\nan\nan.h(676): error C2440: 'return': cannot convert from 'v8::MaybeLocal<v8::Object>' to 'v8::Local<v
8::Object>' (compiling source file ..\src\serialport_win.cpp) [C:\Users\chris\OneDrive\Programmieren\Code\ardui
no\jf\test2\tcpsocket-serialport\node_modules\johnny-five\node_modules\serialport\build\serialport.vcxproj]
C:\Users\chris\OneDrive\Programmieren\Code\arduino\jf\test2\tcpsocket-serialport\node_modules\johnny-five\nod
e_modules\nan\nan.h(676): note: No constructor could take the source type, or constructor overload resolution
was ambiguous (compiling source file ..\src\serialport_win.cpp)
C:\Users\chris\OneDrive\Programmieren\Code\arduino\jf\test2\tcpsocket-serialport\node_modules\johnny-five\node_
modules\nan\nan.h(683): error C2039: 'Use': is not a member of 'node::Buffer' (compiling source file ..\src\ser
ialport_win.cpp) [C:\Users\chris\OneDrive\Programmieren\Code\arduino\jf\test2\tcpsocket-serialport\node_modules
\johnny-five\node_modules\serialport\build\serialport.vcxproj]
C:\Users\chris\.node-gyp\4.6.1\include\node\node_buffer.h(11): note: see declaration of 'node::Buffer' (compi
ling source file ..\src\serialport_win.cpp)
C:\Users\chris\OneDrive\Programmieren\Code\arduino\jf\test2\tcpsocket-serialport\node_modules\johnny-five\node_
modules\nan\nan.h(683): error C3861: 'Use': identifier not found (compiling source file ..\src\serialport_win.c
pp) [C:\Users\chris\OneDrive\Programmieren\Code\arduino\jf\test2\tcpsocket-serialport\node_modules\johnny-five\
node_modules\serialport\build\serialport.vcxproj]
..\src\serialport_win.cpp(152): warning C4311: 'type cast': pointer truncation from 'HANDLE' to 'int' [C:\Users
\chris\OneDrive\Programmieren\Code\arduino\jf\test2\tcpsocket-serialport\node_modules\johnny-five\node_modules\
serialport\build\serialport.vcxproj]
..\src\serialport_win.cpp(152): warning C4302: 'type cast': truncation from 'HANDLE' to 'int' [C:\Users\chris\O
neDrive\Programmieren\Code\arduino\jf\test2\tcpsocket-serialport\node_modules\johnny-five\node_modules\serialpo
rt\build\serialport.vcxproj]
..\src\serialport_win.cpp(177): warning C4312: 'type cast': conversion from 'int' to 'HANDLE' of greater size [
C:\Users\chris\OneDrive\Programmieren\Code\arduino\jf\test2\tcpsocket-serialport\node_modules\johnny-five\node_
modules\serialport\build\serialport.vcxproj]
..\src\serialport_win.cpp(179): warning C4312: 'type cast': conversion from 'int' to 'HANDLE' of greater size [
C:\Users\chris\OneDrive\Programmieren\Code\arduino\jf\test2\tcpsocket-serialport\node_modules\johnny-five\node_
modules\serialport\build\serialport.vcxproj]
..\src\serialport_win.cpp(183): warning C4312: 'type cast': conversion from 'int' to 'HANDLE' of greater size [
C:\Users\chris\OneDrive\Programmieren\Code\arduino\jf\test2\tcpsocket-serialport\node_modules\johnny-five\node_
modules\serialport\build\serialport.vcxproj]
..\src\serialport_win.cpp(185): warning C4312: 'type cast': conversion from 'int' to 'HANDLE' of greater size [
C:\Users\chris\OneDrive\Programmieren\Code\arduino\jf\test2\tcpsocket-serialport\node_modules\johnny-five\node_
modules\serialport\build\serialport.vcxproj]
..\src\serialport_win.cpp(189): warning C4312: 'type cast': conversion from 'int' to 'HANDLE' of greater size [
C:\Users\chris\OneDrive\Programmieren\Code\arduino\jf\test2\tcpsocket-serialport\node_modules\johnny-five\node_
modules\serialport\build\serialport.vcxproj]
..\src\serialport_win.cpp(191): warning C4312: 'type cast': conversion from 'int' to 'HANDLE' of greater size [
C:\Users\chris\OneDrive\Programmieren\Code\arduino\jf\test2\tcpsocket-serialport\node_modules\johnny-five\node_
modules\serialport\build\serialport.vcxproj]
..\src\serialport_win.cpp(196): warning C4312: 'type cast': conversion from 'int' to 'HANDLE' of greater size [
C:\Users\chris\OneDrive\Programmieren\Code\arduino\jf\test2\tcpsocket-serialport\node_modules\johnny-five\node_
modules\serialport\build\serialport.vcxproj]
..\src\serialport_win.cpp(208): warning C4312: 'type cast': conversion from 'int' to 'HANDLE' of greater size [
C:\Users\chris\OneDrive\Programmieren\Code\arduino\jf\test2\tcpsocket-serialport\node_modules\johnny-five\node_
modules\serialport\build\serialport.vcxproj]
..\src\serialport_win.cpp(308): warning C4311: 'type cast': pointer truncation from 'HANDLE' to 'int' [C:\Users
\chris\OneDrive\Programmieren\Code\arduino\jf\test2\tcpsocket-serialport\node_modules\johnny-five\node_modules\
serialport\build\serialport.vcxproj]
..\src\serialport_win.cpp(308): warning C4302: 'type cast': truncation from 'HANDLE' to 'int' [C:\Users\chris\O
neDrive\Programmieren\Code\arduino\jf\test2\tcpsocket-serialport\node_modules\johnny-five\node_modules\serialpo
rt\build\serialport.vcxproj]
..\src\serialport_win.cpp(318): warning C4311: 'type cast': pointer truncation from 'HANDLE' to 'int' [C:\Users
\chris\OneDrive\Programmieren\Code\arduino\jf\test2\tcpsocket-serialport\node_modules\johnny-five\node_modules\
serialport\build\serialport.vcxproj]
..\src\serialport_win.cpp(318): warning C4302: 'type cast': truncation from 'HANDLE' to 'int' [C:\Users\chris\O
neDrive\Programmieren\Code\arduino\jf\test2\tcpsocket-serialport\node_modules\johnny-five\node_modules\serialpo
rt\build\serialport.vcxproj]
..\src\serialport_win.cpp(328): warning C4312: 'type cast': conversion from 'int' to 'HANDLE' of greater size [
C:\Users\chris\OneDrive\Programmieren\Code\arduino\jf\test2\tcpsocket-serialport\node_modules\johnny-five\node_
modules\serialport\build\serialport.vcxproj]
..\src\serialport_win.cpp(353): warning C4312: 'type cast': conversion from 'int' to 'HANDLE' of greater size [
C:\Users\chris\OneDrive\Programmieren\Code\arduino\jf\test2\tcpsocket-serialport\node_modules\johnny-five\node_
modules\serialport\build\serialport.vcxproj]
..\src\serialport_win.cpp(366): warning C4312: 'type cast': conversion from 'int' to 'HANDLE' of greater size [
C:\Users\chris\OneDrive\Programmieren\Code\arduino\jf\test2\tcpsocket-serialport\node_modules\johnny-five\node_
modules\serialport\build\serialport.vcxproj]
..\src\serialport_win.cpp(401): warning C4312: 'type cast': conversion from 'int' to 'HANDLE' of greater size [
C:\Users\chris\OneDrive\Programmieren\Code\arduino\jf\test2\tcpsocket-serialport\node_modules\johnny-five\node_
modules\serialport\build\serialport.vcxproj]
..\src\serialport_win.cpp(403): warning C4312: 'type cast': conversion from 'int' to 'HANDLE' of greater size [
C:\Users\chris\OneDrive\Programmieren\Code\arduino\jf\test2\tcpsocket-serialport\node_modules\johnny-five\node_
modules\serialport\build\serialport.vcxproj]
..\src\serialport_win.cpp(502): warning C4312: 'type cast': conversion from 'int' to 'HANDLE' of greater size [
C:\Users\chris\OneDrive\Programmieren\Code\arduino\jf\test2\tcpsocket-serialport\node_modules\johnny-five\node_
modules\serialport\build\serialport.vcxproj]
..\src\serialport_win.cpp(511): warning C4312: 'type cast': conversion from 'int' to 'HANDLE' of greater size [
C:\Users\chris\OneDrive\Programmieren\Code\arduino\jf\test2\tcpsocket-serialport\node_modules\johnny-five\node_
modules\serialport\build\serialport.vcxproj]
gyp ERR! build error
gyp ERR! stack Error: `C:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe` failed with exit code: 1
gyp ERR! stack at ChildProcess.onExit (C:\Users\chris\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\build.js:285:23)
gyp ERR! stack at emitTwo (events.js:87:13)
gyp ERR! stack at ChildProcess.emit (events.js:172:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
gyp ERR! System Windows_NT 10.0.15063
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\chris\\AppData\\Roaming\\npm\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "build" "--fallback-to-build" "--module=C:\\Users\\chris\\OneDrive\\Programmieren\\Code\\arduino\\jf\\test2\\tcpsocket-serialport\\node_modules\\johnny-five\\node_modules\\serialport\\build\\serialport\\v1.7.4\\Release\\node-v46-win32-x64\\serialport.node" "--module_name=serialport" "--module_path=C:\\Users\\chris\\OneDrive\\Programmieren\\Code\\arduino\\jf\\test2\\tcpsocket-serialport\\node_modules\\johnny-five\\node_modules\\serialport\\build\\serialport\\v1.7.4\\Release\\node-v46-win32-x64"
gyp ERR! cwd C:\Users\chris\OneDrive\Programmieren\Code\arduino\jf\test2\tcpsocket-serialport\node_modules\johnny-five\node_modules\serialport
gyp ERR! node -v v4.6.1
gyp ERR! node-gyp -v v3.6.0
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute 'node-gyp.cmd build --fallback-to-build --module=C:\Users\chris\OneDrive\Programmieren\Code\arduino\jf\test2\tcpsocket-serialport\node_modules\johnny-five\node_modules\serialport\build\serialport\v1.7.4\Release\node-v46-win32-x64\serialport.node --module_name=serialport --module_path=C:\Users\chris\OneDrive\Programmieren\Code\arduino\jf\test2\tcpsocket-serialport\node_modules\johnny-five\node_modules\serialport\build\serialport\v1.7.4\Release\node-v46-win32-x64' (1)
node-pre-gyp ERR! stack at ChildProcess.<anonymous> (C:\Users\chris\OneDrive\Programmieren\Code\arduino\jf\test2\tcpsocket-serialport\node_modules\johnny-five\node_modules\serialport\node_modules\node-pre-gyp\lib\util\compile.js:83:29)
node-pre-gyp ERR! stack at emitTwo (events.js:87:13)
node-pre-gyp ERR! stack at ChildProcess.emit (events.js:172:7)
node-pre-gyp ERR! stack at maybeClose (internal/child_process.js:829:16)
node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)
node-pre-gyp ERR! System Windows_NT 10.0.15063
node-pre-gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\chris\\OneDrive\\Programmieren\\Code\\arduino\\jf\\test2\\tcpsocket-serialport\\node_modules\\johnny-five\\node_modules\\serialport\\node_modules\\node-pre-gyp\\bin\\node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd C:\Users\chris\OneDrive\Programmieren\Code\arduino\jf\test2\tcpsocket-serialport\node_modules\johnny-five\node_modules\serialport
node-pre-gyp ERR! node -v v4.6.1
node-pre-gyp ERR! node-pre-gyp -v v0.6.7
node-pre-gyp ERR! not ok
Failed to execute 'node-gyp.cmd build --fallback-to-build --module=C:\Users\chris\OneDrive\Programmieren\Code\arduino\jf\test2\tcpsocket-serialport\node_modules\johnny-five\node_modules\serialport\build\serialport\v1.7.4\Release\node-v46-win32-x64\serialport.node --module_name=serialport --module_path=C:\Users\chris\OneDrive\Programmieren\Code\arduino\jf\test2\tcpsocket-serialport\node_modules\johnny-five\node_modules\serialport\build\serialport\v1.7.4\Release\node-v46-win32-x64' (1)
tcpsocket-serialport#0.1.0 C:\Users\chris\OneDrive\Programmieren\Code\arduino\jf\test2\tcpsocket-serialport
+-- del#1.2.1
| +-- each-async#1.1.1
| | +-- onetime#1.1.0
...
| +-- string_decoder#1.0.1
| | `-- safe-buffer#5.0.1 deduped
| `-- util-deprecate#1.0.2 deduped
`-- jsdoctypeparser#1.2.0
`-- lodash#3.10.1
npm WARN tcpsocket-serialport#0.1.0 license should be a valid SPDX license expression
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: serialport#1.7.4 (node_modules\johnny-five\node_modules\serialport):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: serialport#1.7.4 install: `node-pre-gyp install --fallback-to-build`
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1
Another package i found was this
https://www.npmjs.com/package/tcp-serial
Sadly it says ist tcp but if you try the given example it just gives you the error message, that it only works with udp. Anyways, if someone had an idea how to get either of those 2 running I'd be really thankful. I will still be trying to solve it by myself to and be sure to post an answer if I find one. Thanks in advance and
Greetings Chris
Turns out the mistake was pretty obvious once I took a look in the package.json.
The problem was I already included johnny-five in a parent folder which led to a conflict here. So if anyone happens to stumble over the same problem, don't install johnny five and try to install tcpsocket-serialport afterwards.

Node.js ursa installation errors: C2039, C2504, C4430 and C2143

I am trying to install Node.js Ursa module but it shows the error below:
> ursa#0.8.1 install C:\Users\User\Desktop\ursa-master
> node-gyp configure && node-gyp build && node install.js
C:\Users\User\Desktop\ursa-master>node "C:\Program Files\nodejs\node_modules\npm
\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" configure
child_process: customFds option is deprecated, use stdio instead.
C:\Users\User\Desktop\ursa-master>node "C:\Program Files\nodejs\node_modules\npm
\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" build
child_process: customFds option is deprecated, use stdio instead.
Building the projects in this solution one at a time. To enable parallel build,
please add the "/m" switch.
ursaNative.cc
asprintf.cc
c:\users\user\desktop\ursa-master\src\ursaNative.h(14): error C2039: 'ObjectWra
p' : is not a member of 'node' (..\src\ursaNative.cc) [C:\Users\User\Desktop\ur
sa-master\build\ursaNative.vcxproj]
c:\users\user\desktop\ursa-master\src\ursaNative.h(14): error C2504: 'ObjectWra
p' : base class undefined (..\src\ursaNative.cc) [C:\Users\User\Desktop\ursa-ma
ster\build\ursaNative.vcxproj]
c:\users\user\desktop\ursa-master\src\ursaNative.h(22): error C2039: 'Arguments
' : is not a member of 'v8' (..\src\ursaNative.cc) [C:\Users\User\Desktop\ursa-
master\build\ursaNative.vcxproj]
c:\users\user\desktop\ursa-master\src\ursaNative.h(22): error C4430: missing ty
pe specifier - int assumed. Note: C++ does not support default-int (..\src\ursa
Native.cc) [C:\Users\User\Desktop\ursa-master\build\ursaNative.vcxproj]
c:\users\user\desktop\ursa-master\src\ursaNative.h(22): error C2143: syntax err
or : missing ',' before '&' (..\src\ursaNative.cc) [C:\Users\User\Desktop\ursa-
master\build\ursaNative.vcxproj]
c:\users\user\desktop\ursa-master\src\ursaNative.h(23): error C2039: 'Arguments
' : is not a member of 'v8' (..\src\ursaNative.cc) [C:\Users\User\Desktop\ursa-
master\build\ursaNative.vcxproj]
c:\users\user\desktop\ursa-master\src\ursaNative.h(23): error C4430: missing ty
pe specifier - int assumed. Note: C++ does not support default-int (..\src\ursa
Native.cc) [C:\Users\User\Desktop\ursa-master\build\ursaNative.vcxproj]
c:\users\user\desktop\ursa-master\src\ursaNative.h(23): error C2143: syntax err
or : missing ',' before '&' (..\src\ursaNative.cc) [C:\Users\User\Desktop\ursa-
master\build\ursaNative.vcxproj]
c:\users\user\desktop\ursa-master\src\ursaNative.h(24): error C2039: 'Arguments
' : is not a member of 'v8' (..\src\ursaNative.cc) [C:\Users\User\Desktop\ursa-
master\build\ursaNative.vcxproj]
c:\users\user\desktop\ursa-master\src\ursaNative.h(24): error C4430: missing ty
pe specifier - int assumed. Note: C++ does not support default-int (..\src\ursa
Native.cc) [C:\Users\User\Desktop\ursa-master\build\ursaNative.vcxproj]
c:\users\user\desktop\ursa-master\src\ursaNative.h(24): error C2143: syntax err
or : missing ',' before '&' (..\src\ursaNative.cc) [C:\Users\User\Desktop\ursa-
master\build\ursaNative.vcxproj]
c:\users\user\desktop\ursa-master\src\ursaNative.h(25): error C2039: 'Arguments
' : is not a member of 'v8' (..\src\ursaNative.cc) [C:\Users\User\Desktop\ursa-
master\build\ursaNative.vcxproj]
c:\users\user\desktop\ursa-master\src\ursaNative.h(25): error C4430: missing ty
pe specifier - int assumed. Note: C++ does not support default-int (..\src\ursa
Native.cc) [C:\Users\User\Desktop\ursa-master\build\ursaNative.vcxproj]
c:\users\user\desktop\ursa-master\src\ursaNative.h(25): error C2143: syntax err
or : missing ',' before '&' (..\src\ursaNative.cc) [C:\Users\User\Desktop\ursa-
master\build\ursaNative.vcxproj]
c:\users\user\desktop\ursa-master\src\ursaNative.h(26): error C2039: 'Arguments
' : is not a member of 'v8' (..\src\ursaNative.cc) [C:\Users\User\Desktop\ursa-
master\build\ursaNative.vcxproj]
c:\users\user\desktop\ursa-master\src\ursaNative.h(26): error C4430: missing ty
pe specifier - int assumed. Note: C++ does not support default-int (..\src\ursa
Native.cc) [C:\Users\User\Desktop\ursa-master\build\ursaNative.vcxproj]
c:\users\user\desktop\ursa-master\src\ursaNative.h(26): error C2143: syntax err
or : missing ',' before '&' (..\src\ursaNative.cc) [C:\Users\User\Desktop\ursa-
master\build\ursaNative.vcxproj]
c:\users\user\desktop\ursa-master\src\ursaNative.h(27): error C2039: 'Arguments
' : is not a member of 'v8' (..\src\ursaNative.cc) [C:\Users\User\Desktop\ursa-
master\build\ursaNative.vcxproj]
c:\users\user\desktop\ursa-master\src\ursaNative.h(27): error C4430: missing ty
pe specifier - int assumed. Note: C++ does not support default-int (..\src\ursa
Native.cc) [C:\Users\User\Desktop\ursa-master\build\ursaNative.vcxproj]
c:\users\user\desktop\ursa-master\src\ursaNative.h(27): error C2143: syntax err
or : missing ',' before '&' (..\src\ursaNative.cc) [C:\Users\User\Desktop\ursa-
master\build\ursaNative.vcxproj]
c:\users\user\desktop\ursa-master\src\ursaNative.h(28): error C2039: 'Arguments
' : is not a member of 'v8' (..\src\ursaNative.cc) [C:\Users\User\Desktop\ursa-
master\build\ursaNative.vcxproj]
c:\users\user\desktop\ursa-master\src\ursaNative.h(28): error C4430: missing ty
pe specifier - int assumed. Note: C++ does not support default-int (..\src\ursa
Native.cc) [C:\Users\User\Desktop\ursa-master\build\ursaNative.vcxproj]
c:\users\user\desktop\ursa-master\src\ursaNative.h(28): error C2143: syntax err
or : missing ',' before '&' (..\src\ursaNative.cc) [C:\Users\User\Desktop\ursa-
master\build\ursaNative.vcxproj]
c:\users\user\desktop\ursa-master\src\ursaNative.h(29): error C2039: 'Arguments
' : is not a member of 'v8' (..\src\ursaNative.cc) [C:\Users\User\Desktop\ursa-
master\build\ursaNative.vcxproj]
c:\users\user\desktop\ursa-master\src\ursaNative.h(29): error C4430: missing ty
pe specifier - int assumed. Note: C++ does not support default-int (..\src\ursa
Native.cc) [C:\Users\User\Desktop\ursa-master\build\ursaNative.vcxproj]
c:\users\user\desktop\ursa-master\src\ursaNative.h(29): error C2143: syntax err
or : missing ',' before '&' (..\src\ursaNative.cc) [C:\Users\User\Desktop\ursa-
master\build\ursaNative.vcxproj]
c:\users\user\desktop\ursa-master\src\ursaNative.h(30): error C2039: 'Arguments
' : is not a member of 'v8' (..\src\ursaNative.cc) [C:\Users\User\Desktop\ursa-
master\build\ursaNative.vcxproj]
c:\users\user\desktop\ursa-master\src\ursaNative.h(30): error C4430: missing ty
pe specifier - int assumed. Note: C++ does not support default-int (..\src\ursa
Native.cc) [C:\Users\User\Desktop\ursa-master\build\ursaNative.vcxproj]
c:\users\user\desktop\ursa-master\src\ursaNative.h(30): error C2143: syntax err
or : missing ',' before '&' (..\src\ursaNative.cc) [C:\Users\User\Desktop\ursa-
master\build\ursaNative.vcxproj]
c:\users\user\desktop\ursa-master\src\ursaNative.h(31): error C2039: 'Arguments
' : is not a member of 'v8' (..\src\ursaNative.cc) [C:\Users\User\Desktop\ursa-
master\build\ursaNative.vcxproj]
c:\users\user\desktop\ursa-master\src\ursaNative.h(31): error C4430: missing ty
pe specifier - int assumed. Note: C++ does not support default-int (..\src\ursa
Native.cc) [C:\Users\User\Desktop\ursa-master\build\ursaNative.vcxproj]
c:\users\user\desktop\ursa-master\src\ursaNative.h(31): error C2143: syntax err
or : missing ',' before '&' (..\src\ursaNative.cc) [C:\Users\User\Desktop\ursa-
master\build\ursaNative.vcxproj]
c:\users\user\desktop\ursa-master\src\ursaNative.h(32): error C2039: 'Arguments
' : is not a member of 'v8' (..\src\ursaNative.cc) [C:\Users\User\Desktop\ursa-
master\build\ursaNative.vcxproj]
c:\users\user\desktop\ursa-master\src\ursaNative.h(32): error C4430: missing ty
pe specifier - int assumed. Note: C++ does not support default-int (..\src\ursa
Native.cc) [C:\Users\User\Desktop\ursa-master\build\ursaNative.vcxproj]
c:\users\user\desktop\ursa-master\src\ursaNative.h(32): error C2143: syntax err
or : missing ',' before '&' (..\src\ursaNative.cc) [C:\Users\User\Desktop\ursa-
master\build\ursaNative.vcxproj]
c:\users\user\desktop\ursa-master\src\ursaNative.h(33): error C2039: 'Arguments
' : is not a member of 'v8' (..\src\ursaNative.cc) [C:\Users\User\Desktop\ursa-
master\build\ursaNative.vcxproj]
c:\users\user\desktop\ursa-master\src\ursaNative.h(33): error C4430: missing ty
pe specifier - int assumed. Note: C++ does not support default-int (..\src\ursa
Native.cc) [C:\Users\User\Desktop\ursa-master\build\ursaNative.vcxproj]
c:\users\user\desktop\ursa-master\src\ursaNative.h(33): error C2143: syntax err
or : missing ',' before '&' (..\src\ursaNative.cc) [C:\Users\User\Desktop\ursa-
master\build\ursaNative.vcxproj]
c:\users\user\desktop\ursa-master\src\ursaNative.h(34): error C2039: 'Arguments
' : is not a member of 'v8' (..\src\ursaNative.cc) [C:\Users\User\Desktop\ursa-
master\build\ursaNative.vcxproj]
c:\users\user\desktop\ursa-master\src\ursaNative.h(34): error C4430: missing ty
pe specifier - int assumed. Note: C++ does not support default-int (..\src\ursa
Native.cc) [C:\Users\User\Desktop\ursa-master\build\ursaNative.vcxproj]
c:\users\user\desktop\ursa-master\src\ursaNative.h(34): error C2143: syntax err
or : missing ',' before '&' (..\src\ursaNative.cc) [C:\Users\User\Desktop\ursa-
master\build\ursaNative.vcxproj]
c:\users\user\desktop\ursa-master\src\ursaNative.h(35): error C2039: 'Arguments
' : is not a member of 'v8' (..\src\ursaNative.cc) [C:\Users\User\Desktop\ursa-
master\build\ursaNative.vcxproj]
c:\users\user\desktop\ursa-master\src\ursaNative.h(35): error C4430: missing ty
pe specifier - int assumed. Note: C++ does not support default-int (..\src\ursa
Native.cc) [C:\Users\User\Desktop\ursa-master\build\ursaNative.vcxproj]
c:\users\user\desktop\ursa-master\src\ursaNative.h(35): error C2143: syntax err
or : missing ',' before '&' (..\src\ursaNative.cc) [C:\Users\User\Desktop\ursa-
master\build\ursaNative.vcxproj]
c:\users\user\desktop\ursa-master\src\ursaNative.h(36): error C2039: 'Arguments
' : is not a member of 'v8' (..\src\ursaNative.cc) [C:\Users\User\Desktop\ursa-
master\build\ursaNative.vcxproj]
c:\users\user\desktop\ursa-master\src\ursaNative.h(36): error C4430: missing ty
pe specifier - int assumed. Note: C++ does not support default-int (..\src\ursa
Native.cc) [C:\Users\User\Desktop\ursa-master\build\ursaNative.vcxproj]
c:\users\user\desktop\ursa-master\src\ursaNative.h(36): error C2143: syntax err
or : missing ',' before '&' (..\src\ursaNative.cc) [C:\Users\User\Desktop\ursa-
master\build\ursaNative.vcxproj]
c:\users\user\desktop\ursa-master\src\ursaNative.h(37): error C2039: 'Arguments
' : is not a member of 'v8' (..\src\ursaNative.cc) [C:\Users\User\Desktop\ursa-
master\build\ursaNative.vcxproj]
c:\users\user\desktop\ursa-master\src\ursaNative.h(37): error C4430: missing ty
pe specifier - int assumed. Note: C++ does not support default-int (..\src\ursa
Native.cc) [C:\Users\User\Desktop\ursa-master\build\ursaNative.vcxproj]
c:\users\user\desktop\ursa-master\src\ursaNative.h(37): error C2143: syntax err
or : missing ',' before '&' (..\src\ursaNative.cc) [C:\Users\User\Desktop\ursa-
master\build\ursaNative.vcxproj]
c:\users\user\desktop\ursa-master\src\ursaNative.h(40): error C2039: 'Arguments
' : is not a member of 'v8' (..\src\ursaNative.cc) [C:\Users\User\Desktop\ursa-
master\build\ursaNative.vcxproj]
c:\users\user\desktop\ursa-master\src\ursaNative.h(40): error C4430: missing ty
pe specifier - int assumed. Note: C++ does not support default-int (..\src\ursa
Native.cc) [C:\Users\User\Desktop\ursa-master\build\ursaNative.vcxproj]
c:\users\user\desktop\ursa-master\src\ursaNative.h(40): error C2143: syntax err
or : missing ',' before '&' (..\src\ursaNative.cc) [C:\Users\User\Desktop\ursa-
master\build\ursaNative.vcxproj]
c:\users\user\desktop\ursa-master\src\ursaNative.h(41): error C2039: 'Arguments
' : is not a member of 'v8' (..\src\ursaNative.cc) [C:\Users\User\Desktop\ursa-
master\build\ursaNative.vcxproj]
c:\users\user\desktop\ursa-master\src\ursaNative.h(41): error C4430: missing ty
pe specifier - int assumed. Note: C++ does not support default-int (..\src\ursa
Native.cc) [C:\Users\User\Desktop\ursa-master\build\ursaNative.vcxproj]
c:\users\user\desktop\ursa-master\src\ursaNative.h(41): error C2143: syntax err
or : missing ',' before '&' (..\src\ursaNative.cc) [C:\Users\User\Desktop\ursa-
master\build\ursaNative.vcxproj]
c:\users\user\desktop\ursa-master\src\ursaNative.h(42): error C2039: 'Arguments
' : is not a member of 'v8' (..\src\ursaNative.cc) [C:\Users\User\Desktop\ursa-
master\build\ursaNative.vcxproj]
c:\users\user\desktop\ursa-master\src\ursaNative.h(42): error C4430: missing ty
pe specifier - int assumed. Note: C++ does not support default-int (..\src\ursa
Native.cc) [C:\Users\User\Desktop\ursa-master\build\ursaNative.vcxproj]
c:\users\user\desktop\ursa-master\src\ursaNative.h(42): error C2143: syntax err
or : missing ',' before '&' (..\src\ursaNative.cc) [C:\Users\User\Desktop\ursa-
master\build\ursaNative.vcxproj]
c:\users\user\desktop\ursa-master\src\ursaNative.h(47): error C2039: 'Arguments
' : is not a member of 'v8' (..\src\ursaNative.cc) [C:\Users\User\Desktop\ursa-
master\build\ursaNative.vcxproj]
c:\users\user\desktop\ursa-master\src\ursaNative.h(47): error C4430: missing ty
pe specifier - int assumed. Note: C++ does not support default-int (..\src\ursa
Native.cc) [C:\Users\User\Desktop\ursa-master\build\ursaNative.vcxproj]
c:\users\user\desktop\ursa-master\src\ursaNative.h(47): error C2143: syntax err
or : missing ',' before '&' (..\src\ursaNative.cc) [C:\Users\User\Desktop\ursa-
master\build\ursaNative.vcxproj]
..\src\ursaNative.cc(42): error C2039: 'NewSymbol' : is not a member of 'v8::St
ring' [C:\Users\User\Desktop\ursa-master\build\ursaNative.vcxproj]
C:\Users\User\.node-gyp\0.12.0\deps\v8\include\v8.h(1599) : see decla
ration of 'v8::String'
..\src\ursaNative.cc(42): error C2664: 'v8::Local<v8::FunctionTemplate> v8::Fun
ctionTemplate::New(v8::Isolate *,v8::FunctionCallback,v8::Handle<v8::Value>,v8:
:Handle<v8::Signature>,int)' : cannot convert argument 1 from 'v8::Handle<v8::V
alue> (__cdecl *)(const int)' to 'v8::Isolate *' [C:\Users\User\Desktop\ursa-ma
ster\build\ursaNative.vcxproj]
There is no context in which this conversion is possible
..\src\ursaNative.cc(42): error C2227: left of '->GetFunction' must point to cl
ass/struct/union/generic type [C:\Users\User\Desktop\ursa-master\build\ursaNati
ve.vcxproj]
..\src\ursaNative.cc(42): error C3861: 'NewSymbol': identifier not found [C:\Us
ers\User\Desktop\ursa-master\build\ursaNative.vcxproj]
..\src\ursaNative.cc(71): error C2039: 'New' : is not a member of 'v8::String'
[C:\Users\User\Desktop\ursa-master\build\ursaNative.vcxproj]
C:\Users\User\.node-gyp\0.12.0\deps\v8\include\v8.h(1599) : see decla
ration of 'v8::String'
..\src\ursaNative.cc(71): error C3861: 'New': identifier not found [C:\Users\Us
er\Desktop\ursa-master\build\ursaNative.vcxproj]
..\src\ursaNative.cc(74): error C3861: 'ThrowException': identifier not found [
C:\Users\User\Desktop\ursa-master\build\ursaNative.vcxproj]
..\src\ursaNative.cc(83): error C2039: 'New' : is not a member of 'v8::String'
[C:\Users\User\Desktop\ursa-master\build\ursaNative.vcxproj]
C:\Users\User\.node-gyp\0.12.0\deps\v8\include\v8.h(1599) : see decla
ration of 'v8::String'
..\src\ursaNative.cc(83): error C3861: 'ThrowException': identifier not found [
C:\Users\User\Desktop\ursa-master\build\ursaNative.vcxproj]
..\src\ursaNative.cc(83): error C3861: 'New': identifier not found [C:\Users\Us
er\Desktop\ursa-master\build\ursaNative.vcxproj]
..\src\ursaNative.cc(93): error C2882: 'Buffer' : illegal use of namespace iden
tifier in expression [C:\Users\User\Desktop\ursa-master\build\ursaNative.vcxpro
j]
..\src\ursaNative.cc(93): fatal error C1903: unable to recover from previous er
ror(s); stopping compilation [C:\Users\User\Desktop\ursa-master\build\ursaNativ
e.vcxproj]
gyp ERR! build error
gyp ERR! stack Error: `C:\Program Files (x86)\MSBuild\12.0\bin\msbuild.exe` fail
ed with exit code: 1
gyp ERR! stack at ChildProcess.onExit (C:\Program Files\nodejs\node_modules\
npm\node_modules\node-gyp\lib\build.js:267:23)
gyp ERR! stack at ChildProcess.emit (events.js:110:17)
gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:1067
:12)
gyp ERR! System Windows_NT 6.3.9600
gyp ERR! command "node" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modu
les\\node-gyp\\bin\\node-gyp.js" "build"
gyp ERR! cwd C:\Users\User\Desktop\ursa-master
gyp ERR! node -v v0.12.0
gyp ERR! node-gyp -v v1.0.2
gyp ERR! not ok
npm ERR! Windows_NT 6.3.9600
npm ERR! argv "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nodejs
\\node_modules\\npm\\bin\\npm-cli.js" "install"
npm ERR! node v0.12.0
npm ERR! npm v2.5.1
npm ERR! code ELIFECYCLE
npm ERR! ursa#0.8.1 install: `node-gyp configure && node-gyp build && node insta
ll.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the ursa#0.8.1 install script 'node-gyp configure && node-gyp
build && node install.js'.
npm ERR! This is most likely a problem with the ursa package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node-gyp configure && node-gyp build && node install.js
npm ERR! You can get their info via:
npm ERR! npm owner ls ursa
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! C:\Users\User\Desktop\ursa-master\npm-debug.log
I don't have Visual studio 2010, only 2013.
I just downgrade the version of my Node.js, and it's working!

Why is vtable pointer aligned to 8 bytes on x86 compiled program?

I have the following structure in a piece of code (compiled on x86):
0:012> dt prog!_TESTSTRUCT
+0x000 __VFN_table : Ptr32
+0x008 szAddr : Ptr32 Wchar
+0x00c szOpCode : Ptr32 Wchar
+0x010 szMnemonic : Ptr32 Wchar
+0x014 szArgs : Ptr32 Wchar
+0x018 addr : Uint8B
+0x020 nextOffset : Uint8B
As you can see, the vtable ptr, though 4 bytes in size is aligned to 8 bytes.
For reference, here is another structure from the same piece of code, that is normally aligned:
0:012> dt prog!_TESTSTRUCT2
+0x000 __VFN_table : Ptr32
+0x004 pClient : Ptr32 IDebugClient5
+0x008 pDebugControl : Ptr32 IDebugControl4
+0x00c pDebugSystemObjects : Ptr32 IDebugSystemObjects
+0x010 pDebugDataSpaces : Ptr32 IDebugDataSpaces
+0x014 pDebugSymbols : Ptr32 IDebugSymbols3
+0x018 handlesAcquired : Bool
Why is a 32bit ptr on x86 aligned to 8 bytes in the first structure? What am I missing here?
EDIT 1:
class _TESTSTRUCT size(40):
1> +---
1> 0 | {vfptr}
1> 8 | szAddr
1> 12 | szOpCode
1> 16 | szMnemonic
1> 20 | szArgs
1> 24 | addr
1> 32 | nextOffset
1> +---
1>
1> _TESTSTRUCT::$vftable#:
1> | &_TESTSTRUCT_meta
1> | 0
1> 0 | &_TESTSTRUCT::{dtor}
1>
1> _TESTSTRUCT::{dtor} this adjustor: 0
1> _TESTSTRUCT::__delDtor this adjustor: 0
1> _TESTSTRUCT::__vecDelDtor this adjustor: 0
class _TESTSTRUCT2 size(28):
1> +---
1> 0 | {vfptr}
1> 4 | pDebugClient
1> 8 | pDebugControl
1> 12 | pDebugSystemObjects
1> 16 | pDebugDataSpaces
1> 20 | pDebugSymbols
1> 24 | handlesAcquired
1> | <alignment member> (size=3)
1> +---
1>
1> _TESTSTRUCT2::$vftable#:
1> | &_TESTSTRUCT2_meta
1> | 0
1> 0 | &_TESTSTRUCT2::{dtor}
1>
1> _TESTSTRUCT2::{dtor} this adjustor: 0
1> _TESTSTRUCT2::__delDtor this adjustor: 0
1> _TESTSTRUCT2::__vecDelDtor this adjustor: 0
As explained here
http://lolengine.net/blog/2012/10/21/the-stolen-bytes
The 8 byte structure member causes the vfptr to be misaligned to 8 bytes rather than 4 bytes, as vfptr is added to structure after all the other members have been added/aligned. This behavior seems to be Visual Studio specific

32 errors for something that shouldn't be happening

I'm compiling on VC++ 2010. The following code is for a homework assignment:
#include <iostream>
#include <map>
#include "PaintJobEst.h"
using namespace std;
int main( void )
{
map< string, double > data;
double numRooms = 0, costPerGallon = 0, sqrFtWallSpace = 0;
cout << "How many rooms wil you be painting today? " << endl;
cin >> numRooms;
const bool numRoomsAtLeastOne = ( numRooms >= 1 );
if ( !numRoomsAtLeastOne )
{
cout << "INVALID ENTRY: Please enter a value greater than or equal to 1 for the amount of rooms you wish to paint" << endl;
main();
}
cout << "What is the cost of paint per gallon? " << endl;
cin >> costPerGallon;
const bool costCheck = ( costPerGallon >= 10.00 );
if ( !costCheck )
{
cout << "INVALID ENTRY: Please enter a value greater than or equal to 10.00 for the cost-per-gallon of paint you wish to use." << endl;
main();
}
cout << "What is the square feet of wallspace per gallon of paint you wish to cover? " << endl;
cin >> sqrFtWallSpace;
const bool sqrFeetCheck = ( sqrFtWallSpace >= 0 );
if ( !sqrFeetCheck )
{
cout << "INVALID ENTRY: Please enter a value which is NON-NEGATIVE for covering the square feet of wallspace per gallon" << endl;
main();
}
data.insert( pair< string, double >( "numRooms", numRooms ) );
data.insert( pair< string, double >( "costPerGallon", costPerGallon ) );
data.insert( pair< string, double >( "sqrFtWallSpace", sqrFtWallSpace ) );
Estimate( data );
system("pause");
}
Yet, when I compile it, I get flooded with strange errors which are related to how the xfunctional file. Why this is happening, I have no idea. Am I missing an include file somewhere?
Errors
>------ Build started: Project: Project17, Configuration: Debug Win32 ------
1> main.cpp
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\xfunctional(125): error C2784: 'bool std::operator <(const std::_Tree<_Traits> &,const std::_Tree<_Traits> &)' : could not deduce template argument for 'const std::_Tree<_Traits> &' from 'const std::string'
1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\xtree(1885) : see declaration of 'std::operator <'
1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\xfunctional(124) : while compiling class template member function 'bool std::less<_Ty>::operator ()(const _Ty &,const _Ty &) const'
1> with
1> [
1> _Ty=std::string
1> ]
1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\map(71) : see reference to class template instantiation 'std::less<_Ty>' being compiled
1> with
1> [
1> _Ty=std::string
1> ]
1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\xtree(451) : see reference to class template instantiation 'std::_Tmap_traits<_Kty,_Ty,_Pr,_Alloc,_Mfl>' being compiled
1> with
1> [
1> _Kty=std::string,
1> _Ty=double,
1> _Pr=std::less<std::string>,
1> _Alloc=std::allocator<std::pair<const std::string,double>>,
1> _Mfl=false
1> ]
1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\xtree(520) : see reference to class template instantiation 'std::_Tree_nod<_Traits>' being compiled
1> with
1> [
1> _Traits=std::_Tmap_traits<std::string,double,std::less<std::string>,std::allocator<std::pair<const std::string,double>>,false>
1> ]
1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\xtree(659) : see reference to class template instantiation 'std::_Tree_val<_Traits>' being compiled
1> with
1> [
1> _Traits=std::_Tmap_traits<std::string,double,std::less<std::string>,std::allocator<std::pair<const std::string,double>>,false>
1> ]
1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\map(81) : see reference to class template instantiation 'std::_Tree<_Traits>' being compiled
1> with
1> [
1> _Traits=std::_Tmap_traits<std::string,double,std::less<std::string>,std::allocator<std::pair<const std::string,double>>,false>
1> ]
1> c:\users\holland\documents\code\projects\studying\chapter6\project17\project17\main.cpp(13) : see reference to class template instantiation 'std::map<_Kty,_Ty>' being compiled
1> with
1> [
1> _Kty=std::string,
1> _Ty=double
1> ]
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\xfunctional(125): error C2784: 'bool std::operator <(const std::_Tree<_Traits> &,const std::_Tree<_Traits> &)' : could not deduce template argument for 'const std::_Tree<_Traits> &' from 'const std::string'
1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\xtree(1885) : see declaration of 'std::operator <'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\xfunctional(125): error C2784: 'bool std::operator <(const std::_Tree<_Traits> &,const std::_Tree<_Traits> &)' : could not deduce template argument for 'const std::_Tree<_Traits> &' from 'const std::string'
1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\xtree(1885) : see declaration of 'std::operator <'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\xfunctional(125): error C2784: 'bool std::operator <(const std::unique_ptr<_Ty,_Dx> &,const std::unique_ptr<_Ty2,_Dx2> &)' : could not deduce template argument for 'const std::unique_ptr<_Ty,_Dx> &' from 'const std::string'
1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\memory(2582) : see declaration of 'std::operator <'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\xfunctional(125): error C2784: 'bool std::operator <(const std::unique_ptr<_Ty,_Dx> &,const std::unique_ptr<_Ty2,_Dx2> &)' : could not deduce template argument for 'const std::unique_ptr<_Ty,_Dx> &' from 'const std::string'
1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\memory(2582) : see declaration of 'std::operator <'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\xfunctional(125): error C2784: 'bool std::operator <(const std::unique_ptr<_Ty,_Dx> &,const std::unique_ptr<_Ty2,_Dx2> &)' : could not deduce template argument for 'const std::unique_ptr<_Ty,_Dx> &' from 'const std::string'
1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\memory(2582) : see declaration of 'std::operator <'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\xfunctional(125): error C2784: 'bool std::operator <(const std::reverse_iterator<_RanIt> &,const std::reverse_iterator<_RanIt2> &)' : could not deduce template argument for 'const std::reverse_iterator<_RanIt> &' from 'const std::string'
1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\xutility(1356) : see declaration of 'std::operator <'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\xfunctional(125): error C2784: 'bool std::operator <(const std::reverse_iterator<_RanIt> &,const std::reverse_iterator<_RanIt2> &)' : could not deduce template argument for 'const std::reverse_iterator<_RanIt> &' from 'const std::string'
1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\xutility(1356) : see declaration of 'std::operator <'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\xfunctional(125): error C2784: 'bool std::operator <(const std::reverse_iterator<_RanIt> &,const std::reverse_iterator<_RanIt2> &)' : could not deduce template argument for 'const std::reverse_iterator<_RanIt> &' from 'const std::string'
1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\xutility(1356) : see declaration of 'std::operator <'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\xfunctional(125): error C2784: 'bool std::operator <(const std::_Revranit<_RanIt,_Base> &,const std::_Revranit<_RanIt2,_Base2> &)' : could not deduce template argument for 'const std::_Revranit<_RanIt,_Base> &' from 'const std::string'
1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\xutility(1179) : see declaration of 'std::operator <'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\xfunctional(125): error C2784: 'bool std::operator <(const std::_Revranit<_RanIt,_Base> &,const std::_Revranit<_RanIt2,_Base2> &)' : could not deduce template argument for 'const std::_Revranit<_RanIt,_Base> &' from 'const std::string'
1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\xutility(1179) : see declaration of 'std::operator <'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\xfunctional(125): error C2784: 'bool std::operator <(const std::_Revranit<_RanIt,_Base> &,const std::_Revranit<_RanIt2,_Base2> &)' : could not deduce template argument for 'const std::_Revranit<_RanIt,_Base> &' from 'const std::string'
1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\xutility(1179) : see declaration of 'std::operator <'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\xfunctional(125): error C2784: 'bool std::operator <(const std::pair<_Ty1,_Ty2> &,const std::pair<_Ty1,_Ty2> &)' : could not deduce template argument for 'const std::pair<_Ty1,_Ty2> &' from 'const std::string'
1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\utility(318) : see declaration of 'std::operator <'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\xfunctional(125): error C2784: 'bool std::operator <(const std::pair<_Ty1,_Ty2> &,const std::pair<_Ty1,_Ty2> &)' : could not deduce template argument for 'const std::pair<_Ty1,_Ty2> &' from 'const std::string'
1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\utility(318) : see declaration of 'std::operator <'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\xfunctional(125): error C2784: 'bool std::operator <(const std::pair<_Ty1,_Ty2> &,const std::pair<_Ty1,_Ty2> &)' : could not deduce template argument for 'const std::pair<_Ty1,_Ty2> &' from 'const std::string'
1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\utility(318) : see declaration of 'std::operator <'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\xfunctional(125): error C2676: binary '<' : 'const std::string' does not define this operator or a conversion to a type acceptable to the predefined operator
1> PaintJobEst.cpp
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\xfunctional(125): error C2784: 'bool std::operator <(const std::_Tree<_Traits> &,const std::_Tree<_Traits> &)' : could not deduce template argument for 'const std::_Tree<_Traits> &' from 'const std::string'
1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\xtree(1885) : see declaration of 'std::operator <'
1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\xfunctional(124) : while compiling class template member function 'bool std::less<_Ty>::operator ()(const _Ty &,const _Ty &) const'
1> with
1> [
1> _Ty=std::string
1> ]
1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\map(71) : see reference to class template instantiation 'std::less<_Ty>' being compiled
1> with
1> [
1> _Ty=std::string
1> ]
1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\xtree(451) : see reference to class template instantiation 'std::_Tmap_traits<_Kty,_Ty,_Pr,_Alloc,_Mfl>' being compiled
1> with
1> [
1> _Kty=std::string,
1> _Ty=double,
1> _Pr=std::less<std::string>,
1> _Alloc=std::allocator<std::pair<const std::string,double>>,
1> _Mfl=false
1> ]
1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\xtree(520) : see reference to class template instantiation 'std::_Tree_nod<_Traits>' being compiled
1> with
1> [
1> _Traits=std::_Tmap_traits<std::string,double,std::less<std::string>,std::allocator<std::pair<const std::string,double>>,false>
1> ]
1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\xtree(659) : see reference to class template instantiation 'std::_Tree_val<_Traits>' being compiled
1> with
1> [
1> _Traits=std::_Tmap_traits<std::string,double,std::less<std::string>,std::allocator<std::pair<const std::string,double>>,false>
1> ]
1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\map(81) : see reference to class template instantiation 'std::_Tree<_Traits>' being compiled
1> with
1> [
1> _Traits=std::_Tmap_traits<std::string,double,std::less<std::string>,std::allocator<std::pair<const std::string,double>>,false>
1> ]
1> c:\users\holland\documents\code\projects\studying\chapter6\project17\project17\paintjobest.cpp(9) : see reference to class template instantiation 'std::map<_Kty,_Ty>' being compiled
1> with
1> [
1> _Kty=std::string,
1> _Ty=double
1> ]
Add #include <string> and the problem goes away for me on VC++ 2010.

Resources