Author Topic: I accidently used the debugger, now I can only use a program once. Please help.  (Read 4313 times)

Offline VoltDriven

  • Single posting newcomer
  • *
  • Posts: 4
  • I'm just a random newbie programmer.
    • DarknessVoid
Hello, not too long ago I got a Beginning Programming with C++ For Dummies book from my local library.  Inside the book there was a CD which installs Code::Blocks onto my computer.  I installed it and have made multiple programs that the C++ For Dummies book taught me. 

I would read what he said up to the program, then write the program exactly as he did.  Then I would build it, then run it.  The different programs, like the Hello World! one, would always work. 

I learned that I could build and run the program by pressing F9, so I often did that instead of clicking the build and run button.  Well, at one point, I built a program and ran it and it worked fine, then I went to click F9 again, but I accidently pressed F8, which starts the debugger.  I wasn't sure what I did, but I figured out that I turned the debugger on.  On the bottom where it would usually show whether there were any errors or anything, it showed something I didn't understand (I think it was telling me what it was debugging).  So, I tried to build and run the program again, but it said the debugger was currently working/active/whatever and asked if I wanted to stop it, I clicked yes, but it said that it could not stop the debugger.  So, I just closed C::B.  I went back on C::B and everything seemed fine and dandy, so I made another program.  I built it, I ran it, it worked fine, but then I ran it again and instead of saying "This program calculates the factorial of an entered number.  Please enter number:_", it just showed the blinking white cursor/underscore/_, which made me think it wanted me to type something, but I pushed everything and nothing happened.  I tried to end the program by pressing enter, but nothing happened, even when I pressed it twice. 

In other words, my program wasn't working or responding, even though my code was the same.  I had no choice but to close the window, so it said below that the program was terminated, but the window didn't close.  Then my Norton Anti Virus said SONAR has detected a high security risk in "[insert name of program here].exe", then it said it deleted the security risk, your computer is safe.  So, then I trashed the program and created a new one.  I built it, ran it, it worked fine, but I ran it again, and it didn't show my program again, and wouldn't work. 

Why is it doing this?  I use GNU GCC Compiler, it's a C++ Console Application program.  I have Windows 7 (I don't think I have premium), I don't know how to check to see which version of C::B I have.  Also, when I try to use a program after bringing it up with recent files, it will immediately go to the security risk, underscore showing, thing.

I want to make programs that I can use more than once, what did I do wrong?  Can I fix this?  How?  I appreciate any helpful answer.

Here's a sample code it won't let me run: 
Code: [Select]
//
//  FunctionDemo - demonstrate how to use a function
//                 to simplify the logic of the program.
//
#include <cstdio>
#include <cstdlib>
#include <iostream>
using namespace std;

//
// sumSequence() - return the sum of a series of numbers
//                 entered by the user.  Exit the loop
//                 when the user enters a negative
//                 number.
int sumSequence()
{
    // create a variable into which we will add the
    // numbers entered by the user
    int nAccumulator = 0;

    for(;;)
    {
        // read another value from the user
        int nValue;
        cout << "Next: ";
        cin  >> nValue;

        // exit if nValue is negative
        if (nValue < 0)
        {
            break;
        }
        // add the value entered to the accumulated value
        nAccumulator += nValue;
    }

    // return the accumulated value to the caller
    return nAccumulator;
}

int main(int nNumberofArgs, char* pszArgs[])
{
    cout << "This program sums sequences of numbers.\n"
         << "Enter a series of numbers. Entering a\n"
         << "negative number causes the program to\n"
         << "print the sum and start over with a new\n"
         << "sequence. "
         << "Enter two negatives in a row to end the\n"
         << "program." << endl;

         // stay in a loop getting input from the user
         // until he enters a negative number
         for(;;)
         {
             // accumulate a sequence
             int nSum = sumSequence();

             // if the sum is zero...
             if (nSum == 0)
             {
                 // ...then exit the program
                 break;
             }

             // display the result
             cout << "Sum = " << nSum << endl;
         }

         // wait until the user is ready before terminating the program
         // to allow the user to see the program results
         system("PAUSE");
         return 0;
}
A random newbie programmer.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 12600
    • Travis build status
1. Turn off your antivirus and try again. If it works you know who to blame.
2. You can see the version on the splash screen or in Help -> About
3. There is know bug with stopping the debugger
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline VoltDriven

  • Single posting newcomer
  • *
  • Posts: 4
  • I'm just a random newbie programmer.
    • DarknessVoid
But if it says there's a high security risk, then I turn off my anti-virus, won't that kill my computer?

Oh, my version is:  svn build rev 5473 (2009-02-26T13:17:36.192671Z) gcc 4.2.4 Windows/unicode

I don't really understand what you were trying to say on your third point.  There is no known bug when using the debugger?  There is no bug in the debugger?  Please specify.
A random newbie programmer.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 12600
    • Travis build status
But if it says there's a high security risk, then I turn off my anti-virus, won't that kill my computer?
Don't know, I don't use antivirus software at all...

Oh, my version is:  svn build rev 5473 (2009-02-26T13:17:36.192671Z) gcc 4.2.4 Windows/unicode
Pretty old ...

I don't really understand what you were trying to say on your third point.  There is no known bug when using the debugger?  There is no bug in the debugger?  Please specify.
Sorry, I've misspelled "known", eating the last character...
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline VoltDriven

  • Single posting newcomer
  • *
  • Posts: 4
  • I'm just a random newbie programmer.
    • DarknessVoid
Where can I get the latest software, then?
A random newbie programmer.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 12600
    • Travis build status
Nightlies, download section of the site.

But the latest version won't fix the "security risk" problem, you have to teach Norton (Anti) Virus to not treat your generated exes as viruses...
BTW, Norton (Anti) Virus is regarded as a poor, weak anti virus software...
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]