Code::Blocks Forums

User forums => Using Code::Blocks => Topic started by: pion on August 30, 2021, 11:34:08 am

Title: C exe file crashing
Post by: pion on August 30, 2021, 11:34:08 am
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!
Title: Re: C exe file crashing
Post by: 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.

Title: Re: C exe file crashing
Post by: pion on August 30, 2021, 01:23:53 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
Title: Re: C exe file crashing
Post by: pion on August 30, 2021, 02:26:36 pm
I found a solution!

After searching on other forums, writing "system("pause") before the return statement worked.
Title: Re: C exe file crashing
Post by: Commaster on August 30, 2021, 05:12:19 pm
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)