函数定义错误,类没有成员

时间:2014-11-22 03:24:52

标签: c++ visual-studio visual-studio-2012 gcc

我正在创建一个初学者级项目,创建一个使用Visual Studio和Windows窗体计算工作者工作时间的UI。我的错误在以下函数中,我尝试将值分配给文本框。所有“ToDouble”显示错误类“System :: String”没有成员“ToDouble”,并且朝向末尾(S“F”)显示标识符S是未定义和预期的)

void CalculateWeeklyHours(void)
         {
             double monday, tuesday, wednesday, thursday,
       friday, saturday, sunday, totalHours;

monday     = this->txtMonday->Text->ToDouble(0);
tuesday    = this->txtTuesday->Text->ToDouble(0);
wednesday  = this->txtWednesday->Text->ToDouble(0);
thursday   = this->txtThursday->Text->ToDouble(0);
friday     = this->txtFriday->Text->ToDouble(0);
saturday   = this->txtSaturday->Text->ToDouble(0);
sunday     = this->txtSunday->Text->ToDouble(0);

totalHours = monday + tuesday + wednesday + thursday +
             friday + saturday + sunday;
this->txtTotalHours->Text = totalHours.ToString(S"F");
             throw(gcnew System::NotImplementedException);
         }

这里的完整代码http://ideone.com/ySgxp1

  

c:\ users \ administrator \ documents \ visual studio 2012 \ projects \ form1 \ form1 \ TimeSheet1.h(604):错误C3921:使用S-prefixed字符串需要/ clr:oldSyntax命令行选项   1 GT;使用/ clr进行编译时,存在从字符串文字类型到System :: String ^的隐式转换。如果需要避免歧义,请转换为System :: String ^   1> c:\ users \ administrator \ documents \ visual studio 2012 \ projects \ form1 \ form1 \ TimeSheet1.h(594):错误C2039:'ToDouble':不是'System :: String'的成员   1 GT; c:\ program files(x86)\ reference assemblies \ microsoft \ framework.netframework \ v4.5 \ mscorlib.dll:参见'System :: String'的声明   1> c:\ users \ administrator \ documents \ visual studio 2012 \ projects \ form1 \ form1 \ TimeSheet1.h(595):错误C2039:'ToDouble':不是'System :: String'的成员   1 GT; c:\ program files(x86)\ reference assemblies \ microsoft \ framework.netframework \ v4.5 \ mscorlib.dll:参见'System :: String'的声明   1> c:\ users \ administrator \ documents \ visual studio 2012 \ projects \ form1 \ form1 \ TimeSheet1.h(596):错误C2039:'ToDouble':不是'System :: String'的成员   1 GT; c:\ program files(x86)\ reference assemblies \ microsoft \ framework.netframework \ v4.5 \ mscorlib.dll:参见'System :: String'的声明   1> c:\ users \ administrator \ documents \ visual studio 2012 \ projects \ form1 \ form1 \ TimeSheet1.h(597):错误C2039:'ToDouble':不是'System :: String'的成员   1 GT; c:\ program files(x86)\ reference assemblies \ microsoft \ framework.netframework \ v4.5 \ mscorlib.dll:参见'System :: String'的声明   1> c:\ users \ administrator \ documents \ visual studio 2012 \ projects \ form1 \ form1 \ TimeSheet1.h(598):错误C2039:'ToDouble':不是'System :: String'的成员   1 GT; c:\ program files(x86)\ reference assemblies \ microsoft \ framework.netframework \ v4.5 \ mscorlib.dll:参见'System :: String'的声明   1> c:\ users \ administrator \ documents \ visual studio 2012 \ projects \ form1 \ form1 \ TimeSheet1.h(599):错误C2039:'ToDouble':不是'System :: String'的成员   1 GT; c:\ program files(x86)\ reference assemblies \ microsoft \ framework.netframework \ v4.5 \ mscorlib.dll:参见'System :: String'的声明   1> c:\ users \ administrator \ documents \ visual studio 2012 \ projects \ form1 \ form1 \ TimeSheet1.h(600):错误C2039:'ToDouble':不是'System :: String'的成员   1 GT; c:\ program files(x86)\ reference assemblies \ microsoft \ framework.netframework \ v4.5 \ mscorlib.dll:参见'System :: String'的声明   1> TimeSheet1.cpp(7):警告C4829:主要功能参数可能不正确。考虑'int main(Platform :: Array ^ argv)'

1 个答案:

答案 0 :(得分:0)