News:

As usual while waiting for the next release - don't forget to check the nightly builds in the forum.

Main Menu

C exe file crashing

Started by pion, August 30, 2021, 11:34:08 AM

Previous topic - Next topic

pion

Hello,

I've been using Codeblocks for a few weeks now and noticed something weird. Whenever I try to run a .exe file, it crashes. Sometimes it works fine at the start, but crashes after taking user input. I am coding in C and using Windows 10. I guess it has something to do with the compiler? I'm still a beginner at C, so please don't use too complicated explainations. Thanks!

stahta01

Your program likely has a bug in it that causes it to crash.

I suggest finding an website that helps beginners learn how to code and post your code on that site.

Edit: The above is assuming your program is crashing.

Tim S.

C Programmer working to learn more about C++.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. [url="http://wiki.codeblocks.org"]http://wiki.codeblocks.org[/url]

pion

Quote from: stahta01 on August 30, 2021, 12:34:06 PM
Your program likely has a bug in it that causes it to crash.

I suggest finding an website that helps beginners learn how to code and post your code on that site.

Edit: The above is assuming your program is crashing.

Tim S.

Thanks for the reply,

This applies for all of my programs, even to a simple Hello World program. The code works fine in the IDE

pion

I found a solution!

After searching on other forums, writing "system("pause") before the return statement worked.

Commaster

So it wasn't crashing, just successfully finishing and closing itself...

Code::Blocks merely asks the terminal to stay open after your application is finished.

You can try opening a terminal first and then launching your app from inside it. (Instead of double-clicking the executable)