Help with gcc compiler

zerovit

Distinguished
Jan 1, 2010
19
0
18,560
Hi, i'm a total newbie on programming with zero background on it

I'm currently studying C language now, my problem is


How do i set the gcc directory

the default is C:\users\name

so i need to put my .c files in that directory, i want it to be in my desktop

second problem is

cmd automatically closes after running and compiling using dev c++

any help will be greatly appreciated

thanks

 

Ijack

Distinguished
Is there a particular reason why you are using gcc on Windows? It's a great compiler but perhaps not the easiest to use for a beginner. Have you had a look at Visual Express C++ (despite the name it's a C compiler as well as a C++ one). I think you would find the integrated development environment and built in debugger would make life much easier for you than gcc.
 

shattered space

Distinguished
Dec 18, 2010
26
0
18,580
The console application that you programmed automatically closes because at the end of the program you probably didn't put in a pause period or a input function. As for changing the default save location. Go to tools, environment options, files and directories, then users default directory.
 

randomizer

Distinguished
Yes, the most common reason for console applications closing quickly is because you didn't give it any reason to remain open. Applications execute the instructions you give them and nothing more. If you don't tell it to wait for anything it will terminate very quickly. Usually you will get it to wait for user input at the end. Most (Windows-based) IDEs also have the ability to launch console applications and keep the window open at the end by automatically calling system("pause") just before the application terminates. Don't explicitly add this yourself though as system("pause") is bad, bad, bad.

On a side note: you should ask your professor why he wants you to use a 7 year old IDE just so that you can use GCC.