compile in cmd windows

hi all,
im using MinGW
can anyone tell me the exact step of this?
i know there is a lot of good ide but i really want know this manner.
thank u.
Last edited on
Have you gone over this yet? : http://www.mingw.org/wiki/MinGW_for_First_Time_Users_HOWTO

If so, then what part are you stuck on? Maybe we can clear something up for you.
i use windows 7
here is what i do:
first i set my MinGw directory in environment variable
in window of environment variable i click on new for system variables then i do this:
variable name : MinGW
variable value: C:\MinGW\bin;

after this i go to cmd i do the following:

1- cd my directory source ( C:\user\ramin\desktop\c++ source)
2-g++ test.cpp -o test.exe

in the end tell me 'g++' not recognized as internal or external command......

thank you
Then your path is not set up correctly.
You can directly call set PATH=C:\mingw\bin;%PATH% from the cmd shell, or place the command in a batch script that sets up your environment
I tend to keep the PATH clean of stuff I'm not using.

In my C:\Users\Michael\bin directory, which is in the PATH, I've got a number of batch files that add stuff to the path as needed.

For example, C:\Users\Michael\bin\g++.bat:
1
2
3
@echo off
path C:\MinGW\bin;%PATH%
g++ %*

This does two useful things. I can use g++ normally, no matter whether the PATH has been initialized for it nor not, but also, once the path is initialized, typing "g++" recurs to the correct program (and not my batch file).


The other method is just to set your system PATH. Start Windows Explorer (click the icon on your task bar or use Start and type "explorer" in the box). Click on "Computer" in the left pane. Click on "System Properties" at the top taskbar. Click "Advanced System Settings" on the left. Click the "Environment Variables" button. Add a new variable (or edit the existing one, if any) named "PATH" and add the directory or directories you wish to have in the path, separated by semicolons.

For example, you could create the new variable "PATH" with a value of "C:\MinGW\bin;".

Hope this helps.
does this process work with mingw installed inside+with code::blocks ?
They're unrelated.

C::B knows where to find MinGW and use it.

The console doesn't. So in order to use it you need to add the C:B MinGW path to the system PATH.
when i tried to compile using cmd with C::B\mingw there was a blink of an window which closes immediately. then i added
cin.ignore();
but same result, then i removed a
;
to get a error report, but still same blink window! why is this? i was curious to do by cmd.
Topic archived. No new replies allowed.