2015-04-03 44 views
1

嘿家伙我试图调试我的C++应用程序(运行它不会产生错误,但也没有输出),它给了我一个信号在这一点上发生错误。netbeans C++调试信号是什么

'收到的信号:? (未知信号)”

试图继续与调试使我这个消息:

无法识别或不明确的标志字\“\ 没有寄存器

这是什么原因 ???此行发生错误:

if (input.at(i) == 'I') { 

输入是一个字符串,给定它的值由用户输入(罗马数字)

这是下面的代码的一部分(转换罗马数字阿拉伯数字):

//converting Roman Numerals to Arabic Numbers 
int toArabic() { 

    //converts input to upper case 
    transform(input.begin(), input.end(), input.begin(), ::toupper); 

    int last_digit = 0; 
    int current_digit = 0; 
    int arabic = 0; 

    //checks that input matches desired numerals 
     for (int i = 0; i < sizeof(input); i++) { 
      if (input.at(i) == 'I' || 
        input.at(i) == 'V' || 
        input.at(i) == 'X' || 
        input.at(i) == 'L' || 
        input.at(i) == 'C' || 
        input.at(i) == 'D' || 
        input.at(i) == 'M') { 

     for (int i = 0; i < sizeof(input); i++) { 
      //Error occurs below 
      if (input.at(i) == 'I') { 
       current_digit = 1; 
      } 

      if (input.at(i) == 'V') { 
       current_digit = 5; 
      } 

      if (input.at(i) == 'X') { 
       current_digit = 10; 
      } 

      if (input.at(i) == 'L') { 
       current_digit = 50; 
      } 

      if (input.at(i) == 'C') { 
       current_digit = 100; 
      } 

      if (input.at(i) == 'D') { 
       current_digit = 500; 
      } 

      if (input.at(i) == 'M') { 
       current_digit = 1000; 
      } 

      if (last_digit < current_digit && last_digit != 0) { 
       current_digit -= last_digit; 
       arabic -= last_digit; 
       arabic += current_digit; 
       last_digit = current_digit; 
       current_digit = 0; 

      } else { 
       last_digit = current_digit; 
       arabic += current_digit; 
       current_digit = 0; 
      } 
     } 
    } else { 
       break; 
    } 
     } 
    return arabic; 
} 
+0

我有类似的东西:'无法识别或模棱两可的标志字:\“?\”。'不知道那是什么,我认为它与GDB – 2016-02-20 23:17:40

+0

有关,'nput'定义在哪里?您可能会遇到分段错误 – 2016-02-21 11:25:14

回答

0

我在C++这个问题时,我其实是读这导致抛出异常的无效数据。看起来像NetBeans在调试时没有正确显示这些信息。至少在版本8.1和cygwin gdb中,我观察到了这个问题。 也许是分段错误。调试并检查NULL或无效值。