Author Topic: C exe file crashing  (Read 4494 times)

Offline pion

  • Multiple posting newcomer
  • *
  • Posts: 10
C exe file crashing
« 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!

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7582
    • My Best Post
Re: C exe file crashing
« Reply #1 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.

C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline pion

  • Multiple posting newcomer
  • *
  • Posts: 10
Re: C exe file crashing
« Reply #2 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

Offline pion

  • Multiple posting newcomer
  • *
  • Posts: 10
Re: C exe file crashing
« Reply #3 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.

Online Commaster

  • Almost regular
  • **
  • Posts: 171
Re: C exe file crashing
« Reply #4 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)