# Running a C program from the command prompt



## Yesteryear (Mar 27, 2007)

Hi there, thanks for looking!

I have downloaded and installed gcc compiler "MinGW" in order to compile and run C programs from the Windows command prompt (XP)
I have also altered the Environment settings within the "advanced" tab in MyComputer.

When I run my .C file it will start, however, once the user inputs (multiple choice question program) windows throws an error saying "has encountered a problem and needs to close"

The file I am running is named "p3.c" but when th error pops up it is complaining of "p3.exe" saying it has to close.

Do you have any ideas on how to resolve this? Any help is appreciated!

Thank you!

Dave.


----------



## mt2002 (Sep 14, 2005)

It usually indicates a problem with your code (like referencing a wild pointer will almost always (not "always") cause that problem.) Cannot help much in resolving it without seeing any code. Alternatively, you can run it through a debugger to find where it is crashing at.

Also, you don't ever run a C file, you always run the resulting binary (in you case, its the exe file.)

To help troubleshoot the error, you can also get the exception error code by clicking where it reads "to see what data this error report contains" followed by "to view technical information about the error report". The exception code should be the number on one of the first few lines in the window.


----------

