Author Topic: Code::Blocks console won't close.  (Read 11448 times)

Offline perento

  • Multiple posting newcomer
  • *
  • Posts: 47
Code::Blocks console won't close.
« on: December 04, 2011, 12:21:19 pm »
Hello i just downloaded free Clode Blocks IDE from codeblocks.org and it was all great,
but after 2 weeks or so Code::blocks console wouldnt close so i remove it from my PC and i downloaded it again for free from the same web but again i tryed to compile a small code, it compile fine except saying this:

Process returned -1073741510 <0xC000013A> execution time : 12.42 s
Press any key to continue.

And i cant close to console. I tryed from the little X in top right, tryed whit right mouse button to close it from the minimized in the start menu, also tryed whit Task Manager wich couldnt help at all. I resstart my PC andconsole is closed, ofcourse.

I have DevC++ on my PC but since i know abotu Code::blocks, it becomes my IDE! So easy to work whit and comfortable.
Im using the latest C::B on my 32bit computer, please help me i really dont want to switch my IDE whit DevC or Visual for ever.

regards -perento

Offline JackDawson

  • Multiple posting newcomer
  • *
  • Posts: 37
Re: Code::Blocks console won't close.
« Reply #1 on: December 04, 2011, 11:32:09 pm »
Hello i just downloaded free Clode Blocks IDE from codeblocks.org and it was all great,
but after 2 weeks or so Code::blocks console wouldnt close so i remove it from my PC and i downloaded it again for free from the same web but again i tryed to compile a small code, it compile fine except saying this:

Process returned -1073741510 <0xC000013A> execution time : 12.42 s
Press any key to continue.

And i cant close to console. I tryed from the little X in top right, tryed whit right mouse button to close it from the minimized in the start menu, also tryed whit Task Manager wich couldnt help at all. I resstart my PC andconsole is closed, ofcourse.

I have DevC++ on my PC but since i know abotu Code::blocks, it becomes my IDE! So easy to work whit and comfortable.
Im using the latest C::B on my 32bit computer, please help me i really dont want to switch my IDE whit DevC or Visual for ever.

regards -perento

Try this code and see if your still getting that error.

Code
#include <iostream>
#include <conio.h>
#include <cstdlib>

using namespace std;

int main()
{
   unsigned key;

   do
   {
      cout << "0) Play again"
           << endl
           << "1) Quit" << endl;

      key = getche();
      cout.put('\x8');

   }while(key != '1');

   return 0;
}

If you are, then your most likely missing some sort of DLL that talks to Windows. Are you on XP ? If so, then make sure to install the Windows SDK. If your on Vista or Windows 7, then try installing the Windows 7 SDK. This really should not be the way to solve it, but I have noticed that there are missing DLLs from some computers. So just try the code I provided above first and if that does not work, then install a SDK.

Also, make sure you start a new application for the console before pasting the code above.

Also, you didn't post any source code, so there is really no way to know why it will not close. You could be using code that actually prevents it from closing the normal way. So again, this is not going to get solved without further info from you.

On another note, how come your not using the MingW C++ compiler ? The Dev-CPP version is outdated and not supported last I heard. MingW is updated, free and comes with C::B if you chose the right install file.
« Last Edit: December 04, 2011, 11:38:32 pm by JackDawson »

Offline perento

  • Multiple posting newcomer
  • *
  • Posts: 47
Re: Code::Blocks console won't close.
« Reply #2 on: December 05, 2011, 09:05:48 am »
Im using XP and my both C::B was whit mingW compiler. The reason i didnt post any source code is that it happend whit 2 of my projects here is the small one, was trying to understand the kbhit() function wich still didnt but thats other topic.

#include <iostream>
#include <windows.h>
#include <conio.h>

using namespace std;

int main() //Main Function
{
    while(1)
    {
        if(kbhit()) //return TRUE if key is hited
        {
            cout << "spam 2" << endl;
        }
        else
        {
            cout << "spam" << endl;
        }
    Sleep (1000);
    }

return 0;
}

sorry for not putting the code in frames but i dont know how, im sorry :(

That bug whit un-closable console dotn happen every time, it did randomly, and whit your code i execute like 5 times and all was fine, then i open the project i pasted above and execute few times and nothing happend again. I didnt changed nothing at all but if happen again ill try donwloading SDK, can u please post me a link.
-perento

Offline JackDawson

  • Multiple posting newcomer
  • *
  • Posts: 37
Re: Code::Blocks console won't close.
« Reply #3 on: December 05, 2011, 02:40:09 pm »
Code
#include <iostream>
#include <windows.h>
#include <conio.h>

using namespace std;

int main() //Main Function
{
    while(1)
    {
        if(kbhit()) //return TRUE if key is hited
        {
            cout << "spam 2" << endl;
        }
        else
        {
            cout << "spam" << endl;
        }
    Sleep (1000);
    }

return 0;
}

Ok couple things :

kbhit() - It returns a non-zero integer if a key is in the keyboard buffer. In other words if there is a key that has been pressed and its in the Keyboard Buffer, this function will return back any number except 0. If no key has been pressed, and there is no key in the buffer, then it is the only time it should send back a 0. ( Example, if its 0 then the answer is FALSE. If its anything other then 0 then its TRUE )

And I tested your code in MinGW, it works fine. Also the console closes fine as well. Of course i'm on Windows 7. So not sure why it makes a difference from Windows XP.

Offline perento

  • Multiple posting newcomer
  • *
  • Posts: 47
Re: Code::Blocks console won't close.
« Reply #4 on: December 05, 2011, 03:51:11 pm »
I dont think its in the code since happens whit fe of my projects, they arent big codes
I was spaming compile on few projects and the console seems fine, i might post again whit further info if hapens again and probably going to donwload Windows SDK file

PS: about the kbhit function, i know what is doing but just cant find a place in some source code
Thanks for help JackDawson!

Offline perento

  • Multiple posting newcomer
  • *
  • Posts: 47
Re: Code::Blocks console won't close.
« Reply #5 on: December 06, 2011, 05:53:38 pm »
Sorry for the double post, so after i download the Windows SDK 7.1 newest version the problem still occured. This is the code i used, but again i think its not from the code couse it happens whit few of my source codes so far and i really, really want to use Code::Blocks as my main IDE, would like really much to fix my problem and keep growing my knowledge in C++ couse its a great language wich wont fit in unconfortable IDE like DevC, whit exuse.

If further info is needed ill post everything needed to help resolving this problem!

PS: i hit 2 times the number 4 from the keyboard then tryed to close the console, "Process returned...." pops up, after i couldnt close the console so im forced to resstart my computer now. Would be very, very thankfull if someone look closely into my problem. Thank you!
Code
#include <iostream>
#include <conio.h> //kbhit()
#include <windows.h> //timing
#include "monk.h" //monk header, declerations of class and functions
#include "Troll_Chieftain.h" //troll header, declerations of class and functions

using namespace std;

int main() //Main Function
{
    //Monk
    monk m;
    m.health = 2100;
    m.maxHealth = 2100;
    m.attack = 76;

    //Troll Chieftain
    Troll_Chieftain troll;
    troll.health = 1850;
    troll.attack = 110;

    cout << "Monk health is " << m.health << " and " << m.attack << " attack" << endl;
    cout << "VS" << endl;
    cout << "Troll Chieftain health is " << troll.health << " and " << troll.attack << " attack" << endl;
    cout << endl << endl;
    cout << "Chooice a skill:" << endl;
    cout << "'Basic Attack' - [1]" << endl;
    cout << "'Sunfire Recovery' healing Monk for 100 health  - [2]" << endl;

    bool game_over (false);

    int input;

    while (!game_over)
    {
        if (!kbhit()) //return TRUE if any key is pressed
        {
            input = getch();
        }

        //MONK CHAMPION
        if (input == 49) // auto attacks
        {
            cout << "Attacking" << endl;
            troll.TrollTakesDamage(m.attack);
        }
        else if (input == 50) //Sunfire Recovery heals for 100 hp
        {
            cout << "Healing" << endl;
            m.SunfireRecovery(m.health);
        }
        else
        {
            cout << "Invalid skill!" << endl;
        }

        if (m.health <= 0)//CHECK IF MONK IS DEAD
        {
            game_over = true;
            cout << "You have been trolled by Troll Chieftain, HUEHUEHUE!" << endl;
        }

        //TROLL CHIEFTAIN MOB
        if (troll.health <= 0) //if Troll Chieftain is dead, game over end of main loop
        {
            game_over = true;
            cout << "You have slain Troll Chieftain!" << endl;
        }
        else
        {
            cout << "Troll attack" << endl;
            troll.TrollTakesDamage (m.attack);// if troll chieftain alive attack
        }

    Sleep (2000);
    }

return 0;
}
« Last Edit: December 06, 2011, 06:51:31 pm by perento »

Offline JackDawson

  • Multiple posting newcomer
  • *
  • Posts: 37
Re: Code::Blocks console won't close.
« Reply #6 on: December 08, 2011, 07:17:15 pm »
2 Things here. 1, I can not test your code unless you put it all there... I mean from the looks of it, it looks fine, so the error could be in another file.

The other thing is, what Service Pack are you using for your XP ?  Because the SDK 7.1 you downloaded for XP will ONLY work with XP that has Service Pack 3. It will not work with any other versions of XP.

On a side note, is this your project or you get his code from someone ? Because lets say I test your code, will I need any media ?  Like music or Objects ( Models )..  things of this nature. If so, then you'll have to ZIP it all up if you want me to personally test this for you. If you do not know how to ZIP a program, look up WinZIP or WinRAR. Once you ZIP it up, you can put it on a website like http://www.mediafire.com that offer free file hosting and then paste the link here.
« Last Edit: December 08, 2011, 07:19:21 pm by JackDawson »

Offline perento

  • Multiple posting newcomer
  • *
  • Posts: 47
Re: Code::Blocks console won't close.
« Reply #7 on: December 08, 2011, 08:45:20 pm »
Here is the the big code http://www.mediafire.com/?26xxj2ycfm442rc
and here is the very small one that is bugging me too http://www.mediafire.com/?ocedtt0nd67nv80

I did read Windows SDK require Windows XP Service Pack 3 and i have it on my computer

Im writing this whti a friend that is showing me stuff how a nice readable code should look and etc etc. like a teacher but something happend whit my own code that i did write on my self, so he send me his project wich was exactly the same the miniRPG (its the first link).
The second link is my own code i write on myself and it bugg the console too.

You do not need any objects to compile this, its just a text based real-time game whit a mob.
I hope you figure out what my issue is and help me out.
kind regards!
« Last Edit: December 09, 2011, 03:50:34 am by perento »

Offline JackDawson

  • Multiple posting newcomer
  • *
  • Posts: 37
Re: Code::Blocks console won't close.
« Reply #8 on: December 09, 2011, 05:33:18 pm »
Ok, well the code is fine. I tested it and C::B does not lock up. The console does close for me with no problems. So whatever is going on, its on your Operating System ( Graphic ) end. Basically, your Windows XP might be having a glitch with your graphic drivers. Another issue I have seen in the past is that If you have your Magnify settings in your windows different then where your mouse SHOULD be clicking, it wont find the "hot spot" of where your trying to click. Meaning the graphic settings are out of adjustment. Check your graphic card and other graphic settings. Then maybe you can find out why your Console Window is not closing. But after looking at everything, its been determined in my opinion that this is not a C::B issue and so this Forum will not be able to help. The Forum rules are specific on this very point.

However, Good luck on finding your graphic glitch because that's what it sounds like to me. Its not C::B that is causing the issue.

Offline perento

  • Multiple posting newcomer
  • *
  • Posts: 47
Re: Code::Blocks console won't close.
« Reply #9 on: December 13, 2011, 03:14:24 am »
ok i reinstall the drivers (wich are the same now) i cant use better drivers or just any other graphics drivers due some retarded bug but thats not releated to C::B

I did compile few times and console didnt stucked at all, im very thankfull for yoru support and time sharing to look on my issue, it really helped me!
Have a nice day mate.

-perento