Ok so I dont think I have installed ANY compiler for C++ on my Windows Vista system. So I would need info about that as well.
Anyhow. Just like java can be run using javac and then java w/e w/e... how do I run my .cpp notepad files via the command prompt? I have no problem on my macbook pro (easy to compile using g++) but I wanna know how to compile it on my windows system

I have gone through previous threads and I have no clue what they are talking about. So I really need a step by step guide. From making and saving the program to opening DOS and compiling it kind of thing.

(PS. You can assume I know how to write a simple output 'hello world' program :P I have it saved on my note[ad file on my desktop as helloWorld.cpp NOW WHAT!!?? )

Recommended Answers

All 10 Replies

>>how do I run my .cpp notepad files via the command prompt?
Depends on the compiler you install. There is lots of information about how to create make files for MinGW, which is the MS-Windows port of *nix g++ compiler. Or you can just compile it without a make file. c:> g++ world.c -o world.exe <Enter> The -o flag tells g++ what the final program executable name will be. On *nix they normally do not have extension, but on MS-Windows executable programs normally have *.exe extension.

You may need to set some path environmental variables before you run that command so that MS-Windows knows where g++ program is.

If you use a different compiler, such as vc++ 2010 express, the command line arguments will be completely different.

That's about as simple as I can make it.

Get CodeLite or CodeBlocks which come bundled with MinGW. But since you dont need IDE just grab MinGW and Notepad++ and Have your Windows+R type cmd and there you go!

@firstPerson -- he doesn't want to use an IDE.

may i ask why you don't want to use an IDE?

may i ask why you don't want to use an IDE?

cuz i wanna know the processes under the hood. I have done c++ in the past using an IDE. I'm bored. I wanna know new stuff... is that reason enough? :P

Ok till now I have summaries of what i need. I still dont get it! I have notepad++ (i do my java on it) and yes I have my darn c++ code saved. and i know how to use cmd I just dont know which commands to give to the cmd to compile and run my program.I dont know which compiler/debugger to install! So thats where I need help.

>>how do I run my .cpp notepad files via the command prompt?
Depends on the compiler you install. There is lots of information about how to create make files for MinGW, which is the MS-Windows port of *nix g++ compiler. Or you can just compile it without a make file. c:> g++ world.c -o world.exe <Enter> The -o flag tells g++ what the final program executable name will be. On *nix they normally do not have extension, but on MS-Windows executable programs normally have *.exe extension.

You may need to set some path environmental variables before you run that command so that MS-Windows knows where g++ program is.

If you use a different compiler, such as vc++ 2010 express, the command line arguments will be completely different.

That's about as simple as I can make it.

So lemme get this straight.

Get MinGW, write my code, enter the usual 'g++' command in the windows cmd just like we do on mac ( or any *nix system) and that makes an exe which i can run?
Im not near my windows system today (i have my MBP at niagara falls :D) so I cannot test it.
Also could you be more specific about the path environmental variables?

Thank you so much :)

Since you want to be geekish
start here

Honestly, your's and AncientDragon's replies are the most useful ones I have got yet :D Thanks :D Im going to mark this as solved cuz it looks like i finally got the answer I want :D

I can go on from here.
Thank you everyone for your replies to this trivial topic :P I really appreciate you bearing with me purposely acting dumb :P Apparently people make things simpler if you are that way ;) :P Anyhow. Thanks again :)

And yes, geeks are cool :P so i want to be geekish :P

Honestly, your's and AncientDragon's replies are the most useful ones I have got yet :D Thanks :D Im going to mark this as solved cuz it looks like i finally got the answer I want :D

I can go on from here.
Thank you everyone for your replies to this trivial topic :P I really appreciate you bearing with me purposely acting dumb :P Apparently people make things simpler if you are that way ;) :P Anyhow. Thanks again :)

And yes, geeks are cool :P so i want to be geekish :P

Good thanks

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.