Editing/Compiling Programs on Windows
Author |
Message |
Clayton
|
Posted: Thu Feb 08, 2007 9:10 pm Post subject: Re: Editing/Compiling Programs on Windows |
|
|
Have you run the MinGW installer? If not, do so. After that make sure you edit your PATH variable (following Gandalf's instructions). Now you can write a program. Open up crimson editor and write a Hello World program to test. Save it as a .cpp file to a directory that you can navigate to easily from the command line. Open up the command prompt (as I'm assuming you're using Windows) and navigate to the directory where the file is. Then type in the following:
code: | prompt>> g++ <filename>.cpp -o <filename>.exe
>><filename> |
and if all goes well, your program will execute. |
|
|
|
|
|
Sponsor Sponsor
|
|
|
CodeMonkey2000
|
Posted: Sun Mar 25, 2007 2:06 pm Post subject: RE:Editing/Compiling Programs on Windows |
|
|
I keep getting the " 'g++' isn't recognized as an internal or external command, operable program or a batch file". What gives? I set up my Path variable and g++ is still not recognized |
|
|
|
|
|
CodeMonkey2000
|
Posted: Sun Mar 25, 2007 2:32 pm Post subject: RE:Editing/Compiling Programs on Windows |
|
|
Never mind, I fixed it. |
|
|
|
|
|
klopyrev
|
Posted: Sun Mar 25, 2007 3:47 pm Post subject: Re: Editing/Compiling Programs on Windows |
|
|
I've always used Ready to Program for Java and I find it to be the easiest to use IDE ever. I don't work on big projects, mostly stand-alone files. You just open the IDE, type in the code, press F2 to auto-indent everything, press F1 to run. That's all there is to it. The most convinient feature is the Auto-indentation. No matter how badly indented your code may be (even if its all in 1 line or something), the F2 button will make it perfect. Since I started C++, I've been looking for a simple editor like that. Does anyone know one?
KL |
|
|
|
|
|
Clayton
|
Posted: Sun Mar 25, 2007 5:04 pm Post subject: Re: Editing/Compiling Programs on Windows |
|
|
Are you using the hsa.Console class, or any other classes that are solely for RTP? If you are, I would suggest that you not use them any longer. |
|
|
|
|
|
klopyrev
|
Posted: Sun Mar 25, 2007 5:51 pm Post subject: Re: Editing/Compiling Programs on Windows |
|
|
I really don't like the hsa stuff, except for perhaps graphics. For just test input, output, Console is just so messy. I like the basic System stuff. |
|
|
|
|
|
ericfourfour
|
Posted: Sun Mar 25, 2007 11:15 pm Post subject: Re: Editing/Compiling Programs on Windows |
|
|
This one isn't as simple as double-click the icon, type in your code, press F2, then F1, it is more complex but has "the auto-indentation" and "single key-press run the program" functions that RTP has.
The NetBeans IDE has a function called reformat code which reformats your code the way you like it. It is primarily used for Java development, but there is a c++ plugin for it (in the next version it will support Ruby too). I'm not sure if the reformat button is a single key-press, I think it might require a combination of two or more keys. It can also compile and run programs with a simple press of the F6 key.
Using this IDE is usually for larger project so it might not be what you are looking for.
Really, you should just be working with the command line if your not doing anything really fancy.
You are learning c++ for the contest in Waterloo right? In that case, you should find out what is used there. |
|
|
|
|
|
allen.c++
|
Posted: Fri Jul 06, 2007 8:59 pm Post subject: Re: Editing/Compiling Programs on Windows |
|
|
sry, new to c++ but not to compsci.ca, juz wondering i wanted to learn c++ over the summer so i can prepare for g12 ( even tho we are doing more advance turing and not c++ ) , i chose to go with textpad since ive heard many good comments said about it. but which puglin shud i be dling? which is the "proper" plugin?
and the procedure where we had to edit the path in advance property, how wud that effect the computer?
so from my understanding so far we had the MinGw, an editor, so we creat the code functions and what not using the editor, and by installing and using MinGw we open the file we created using the editor ( in my case the texpad ) from the command promt?
sorry for being so noob but seriously in need of help and answers
reason why i chose textpad : wanted to learn c++ the "complete" way and not taking shortcuts by using programs that does the job for you, such as textpad to dreamweaver in websites.
please give me some reply/comment on my choice and reason for chosing textpad also if possible |
|
|
|
|
|
Sponsor Sponsor
|
|
|
rdrake
|
Posted: Fri Jul 06, 2007 10:34 pm Post subject: RE:Editing/Compiling Programs on Windows |
|
|
You write the programs in your editor (in your case, Textpad). You then switch over to the command line and compile the program. You can then run it. You really shouldn't need a plug-in for Textpad to do this.
Changing your path should not do anything harmful to your system. Just add it after what's already defined for PATH, separating the new entry from the old with a semi colon. |
|
|
|
|
|
FileFantasy
|
Posted: Wed Aug 08, 2007 6:08 pm Post subject: RE:Editing/Compiling Programs on Windows |
|
|
Hey, when I try to compile a .java file into .exe with MinGW by:
gcj hi.java -o hi.exe
It gives me this in command prompt:
<directory>\bin\ld.exe: cannot find -liconv
collect2: ld returned 1 exit status
And the .exe is not created.
What's wrong?
(The .java contains your typical HelloWorld code) |
|
|
|
|
|
wtd
|
Posted: Wed Aug 08, 2007 8:58 pm Post subject: RE:Editing/Compiling Programs on Windows |
|
|
Google is your friend. |
|
|
|
|
|
saltpro15
|
Posted: Mon Jan 05, 2009 7:12 pm Post subject: RE:Editing/Compiling Programs on Windows |
|
|
I'm just getting into c++, I am so absolutely sick of Turing it's ridiculous. First off, thanks for this awesome thread, helped me a lot. That editor is great, and this is so embarrasing to ask but it's better to be embarassed and learn something than to be cool and learn nothing, so what are compilers for? My teacher hasn't taught any c++ to us and doesn't have the time to help me, so I'm relying on the gods of compsci! |
|
|
|
|
|
Insectoid
|
Posted: Mon Jan 05, 2009 7:21 pm Post subject: RE:Editing/Compiling Programs on Windows |
|
|
Compilers turn the english (well, sort of english) code into binary so that the computer can read it. Turing compiles automatically before running. Some languages are interpreted, meaning they 'compile' while they run. |
|
|
|
|
|
DemonWasp
|
Posted: Tue Jan 06, 2009 11:55 am Post subject: RE:Editing/Compiling Programs on Windows |
|
|
Worth noting: Turing is interpreted, meaning that there's a program (called an interpreter, strangely enough) that reads your code as and runs it.
Compilers work slightly differently: they change your code into a format that works directly on the computer. There's no other program running to interpret your code, and your code is no longer in the executable.
Both approaches have a laundry list of advantages and disadvantages. |
|
|
|
|
|
alex141323
|
Posted: Tue Aug 03, 2010 9:00 am Post subject: Re: Editing/Compiling Programs on Windows |
|
|
[quote="[Gandalf]
[*]Add ; and then where you installed MinGW to. If it was C:/Program Files/MinGW then you would add ;C/Program Files/MinGW/bin to the end of what is already there, do not overwrite what is already there![/list]
Now your done. [/quote]
Im having difficulty in that part.what should i do in there?.the only choices when you click edit is variable name and variable value.should i add it in F:\Program Files\PC Connectivity Solution\;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem???
I really dont know how to work this out. im just a new programmer. |
|
|
|
|
|
|
|