0

我刚刚开始使用 Visual C++ 2008 为我的 PC 创建应用程序。当从 Visual c++ 运行时,程序在调试和发布模式下工作。

当我在 Visual c++ 关闭并单击按钮时运行释放时发生未处理的异常。

那么这实际上意味着什么?如何解决问题?

谢谢

 See the end of this message for details on invoking 
 just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text **************
System.OverflowException: Value was either too large or too small for a character.
   at System.Convert.ToChar(Int32 value)
   at gorskikotar.Form1.chekSum(String DtCS) in c:\users\freza\desktop\ozalj jednajedinica v100\gorskikotar\form1.h:line 1151
   at gorskikotar.Form1.slanjeKomande(String tip, String group, String unit, String komanda) in c:\users\freza\desktop\ozalj jedna jedinica v100\gorskikotar\form1.h:line 1127
   at gorskikotar.Form1.testAlarmi(String group, String unit) in c:\users\freza\desktop\ozalj jedna jedinica v100\gorskikotar\form1.h:line 1024
  at gorskikotar.Form1.uredajiZaTest() in c:\users\freza\desktop\ozalj jedna jedinica v100\gorskikotar\form1.h:line 1011
   at gorskikotar.Form1.button8_Click(Object sender, EventArgs e) in c:\users\freza\desktop\ozalj jedna jedinica v100\gorskikotar\form1.h:line 529
4

1 回答 1

0

我发现了你的问题:在你链接到的代码中(它应该真的在问题中)你声明了变量sum,但你没有初始化它。Visual Studio 很有帮助并为您清除它,但是当在 VS 之外运行时,这个变量可以是任何东西。

将声明行更改为:

long  sum = 0, i, a, b;
于 2012-07-27T09:32:36.820 回答