Putting C:\Dev-Cpp\bin and C:\Dev-Cpp on your PATH
The following assumes that you are logged on with Administrator
privileges. Since that is the (amazingly insecure) default with
Microsoft, you may assume that this is the case if you do not know
otherwise.
- Determine what drive you installed Dev-Cpp onto -- you can
look in Windows Explorer to find this out. Let us assume for
this example that you want to install on the C: drive.
- If you have installed on the D: drive (for example), then
instead of C:\Dev-Cpp\bin in the following,
write D:\Dev-Cpp\bin
To add C:\Dev-Cpp\bin and C:\Dev-Cpp to your PATH environment
variable: Windows XP, Windows 2000
- Start --> right click on "My Computer" --> select
"Properties" from the menu --> click on "Advanced" tab
--> "Environment Variables" tab near the bottom --> click
on "Path" in the "System Variables" window panel near the
bottom -> click on the "Edit" button.
- VERY IMPORTANT: Press the "End" key on your keyboard
to go to the end of what is already on your PATH. Do not delete
the existing content of your PATH variable. If you accidentally
do so, click "Cancel", and press "Edit" again.
- Add the following at the end of what is already the value
of the PATH variable:
;C:\Dev-Cpp\bin;C:\Dev-Cpp
For example, after I have done that, my PATH variable looks
something like this:
%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;C:\Dev-Cpp\bin;C:\Dev-Cpp
- Click all three "OK" buttons to close all the windows that
you have opened.
To add C:\Dev-Cpp\bin and C:\Dev-Cpp to your PATH environment
variable: Windows 9x, Windows ME
- Edit C:\autoexec.bat; create it if it does not
exist, using a text editor such as notepad,
wordpad, edit, ...
- At the end of the file C:\autoexec.bat put the following:
set PATH=%PATH%;C:\Dev-Cpp\bin;C:\Dev-Cpp
- I suggest adding the following line to your
C:\AUTOEXEC.BAT file, so that you can conveniently
edit the previous commands on the command line:
doskey /insert > nul
- I also suggest adding the following as the first line in
your C:\AUTOEXEC.BAT file just to reduce the text that
appears on your screen while Windows 98 boots:
@echo off
- Note that you have written some Bat
Language
- Save the file
- Make sure that it was saved as C:\autoexec.bat and
not C:\autoexec.bat.txt This is a little bit
tricky, as Microsoft software is so user friendly that
it protects you from knowing what you are doing
:-)
To compile the program prog.cpp using the Dev-Cpp
C++ compiler on the command line:
- Open a command prompt: Start -> All Programs ->
Accessories -> Command Prompt
- Edit and save your program
- If you cannot save the file, make sure you are in a
directory that you have permission to write to.
- Never work in the C:\Dev-Cpp\bin directory.
- Type
g++ -Wall -o prog prog.cpp
- Note that:
- -Wall is an option to the g++ command
that enables all compiler warnings: always enable all
warnings, so that the compiler can give you the most help
- -o prog is an option to the g++ command
that specifies that "prog" is the name of the
executable program that will be created by the compiler.
- The last thing on the command line is the name of the C++
source file that is input to the compiler.