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.
#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.
#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.
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!
#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;
}