PDA

View Full Version : Compiler that doesn't need to be installed



Akkernight
01-21-2009, 11:20 AM
Sounds silly, I know, but atm moment I only got access to a public PC and I really wanna code! So, could anyone give me a link to a free compiler that doesn't need to install? Or more specific, doesn't need administrative rights?
Thanks in advance!

laserlight
01-21-2009, 11:23 AM
The MinGW port of GCC should fit the bill. You just need to grab the compressed archives and lug them around in a thumb drive. Oh, but maybe you should convert the archives to zip archives instead of the gzipped tarballs that you download.

Akkernight
01-21-2009, 11:27 AM
Ok... I found MinGW on SourceForge, but there is a long list of avaible downloads, which one do I choose? :P

laserlight
01-21-2009, 11:33 AM
Choose the automated installer. When you run the installer, select the option to just download without installing (but then maybe you would like to install it on your home computer).

Actually, in a recent thread cyberfish mentioned an unofficial version of MinGW from nuwen.net (http://nuwen.net/mingw.html) that is more up to date and comes in one zip archive, so perhaps you would want to try that instead. I have not tried it myself, and it is nonetheless unofficial, but apparently cyberfish has not had trouble with it, so it might be worth a try.

Akkernight
01-21-2009, 12:03 PM
ok, I DLed that package, and when I tried unpacking it the PC started sounding like a jet engine o.o like, seriously, like it was picking up speed, and stuff, kinda scared me, 'cause it's a public PC and if I blow it up, I have to pay it xP

laserlight
01-21-2009, 12:14 PM
ok, I DLed that package, and when I tried unpacking it the PC started sounding like a jet engine o.o like, seriously, like it was picking up speed, and stuff, kinda scared me, 'cause it's a public PC and if I blow it up, I have to pay it xP
Clearly, decompressing the archive(s) is hard work :D But nah, it should be okay. By the way, did you choose the official installer or the nuwen.net one? In either case, to make it easier to use the compiler from the command line, you might want to set the user variables for path to include MinGW's bin directory.

Oh, and a thought came to mind: I suspect that the Code::Blocks compiler requires admin privileges to install, but maybe one can package it such that admin privileges are not required. That way you would have more than a compiler at your disposal.

abachler
01-21-2009, 12:49 PM
thats just the cpu fan speeding up due to having a load. Although I think the installer woudl count as installing, so best to just find a self extracting zipped version of the MinGW 5.1.4 compiler package. (http://www.stoney-tony.com/downloads/MinGW-5.1.4.exe)

Akkernight
01-21-2009, 12:55 PM
I got the nuwen one, it has loads of .exe files, which I have no idea what to use for o.o ... So, any IDE that doesn't need install? Or just a just a little tutorial on how to compile using this? Like, do I code in Notepad and then use what to compile?

abachler
01-21-2009, 01:01 PM
for mingw, you ned to set the path variable to point to the bin directory



path=%PATH%;c:\mingw\bin


then you compile by calling mingw-gcc.exe with the correct parameters, see mingw-gcc -h for help

laserlight
01-21-2009, 01:02 PM
I got the nuwen one, it has loads of .exe files, which I have no idea what to use for
Most of the files would be supporting the compiler in some way or another. If you want to compile for C, the compiler is gcc (gcc.exe) and for C++ it would be g++ (g++.exe). With only a text editor, you would need to compile from the command line, e.g.,

gcc -o program.exe source.c
Read the GCC 4.3.2 manual (http://gcc.gnu.org/onlinedocs/gcc-4.3.2/gcc/) for more information. I assume that you have already followed the installation instructions given by nuwen.net, though a slight modification would be to change the user variables version of the path if you cannot change the system-wide version.


Like, do I code in Notepad and then use what to compile?
Notepad would be fine, though I would suggest Notepad++ (http://notepad-plus.sourceforge.net/uk/site.htm) for something more programmer oriented. Download and unzip npp.5.1.4.bin.zip for immediate use.

Akkernight
01-21-2009, 01:04 PM
Yeah, I use Notepad++ at home, just don't want to add too much to this PC :P

And path variable o.O?

laserlight
01-21-2009, 01:07 PM
And path variable o.O?
On Windows XP it can be found via: Start -> (right click) My Computer -> Properties -> Advanced -> Environment Variables. The nuwen.net installation instruction states something similiar.

Akkernight
01-21-2009, 01:12 PM
ok, this I don't understand xP I found those variables, so I add a new one and enter
path=%PATH%;c:\mingw\bin just like that? Also include the "path=" ? and I don't have any mingw-gcc.exe

Commandline or non-IDE compilation is clearly the worst thing ever invented! >.<

laserlight
01-21-2009, 01:18 PM
I found those variables, so I add a new one and enter
If it already exists, update it. The semi-colon is the path separator.


I don't have any mingw-gcc.exe
It should be gcc.exe then.

Akkernight
01-21-2009, 01:25 PM
And by path seperator, it means? I don't have to include what's before it?

laserlight
01-21-2009, 01:28 PM
And by path seperator, it means? I don't have to include what's before it?
For example, suppose the existing path is like this:

%SystemRoot%\system32
You would then change it to:

%SystemRoot%\system32;C:\MinGW\bin

Akkernight
01-21-2009, 01:31 PM
Why o.o? C:\ ain't in system32, is it?

laserlight
01-21-2009, 01:33 PM
Why o.o? C:\ ain't in system32, is it?
That's what the path separator is for. It says that you have one path, "%SystemRoot%\system32", and another "C:\MinGW\bin".

Akkernight
01-21-2009, 01:48 PM
ohh... Now I get it xD

But why does he use path=%path% then o.O?

laserlight
01-21-2009, 01:52 PM
But why does he use path=%path% then o.O?
The %XYZ% refers to an existing environment variable named XYZ. Anyway, you don't need to care too much about this when all you want to do is set the system path so you can use your C and C++ compilers without fully specifying their pathnames :)

Akkernight
01-21-2009, 02:09 PM
Yeah, I figured it out, feel dumb now xD anyways, I didn't have admin rights, so couldn't place it under system variables, but under this account's variables, and just named it Path :P oh and I got it working, so thanks for helping me with this! Learned how to compile using commandline and learned loads about how windows command stuff works ^^

abachler
01-21-2009, 05:35 PM
ok, this I don't understand xP I found those variables, so I add a new one and enter
path=%PATH%;c:\mingw\bin just like that? Also include the "path=" ? and I don't have any mingw-gcc.exe

I provided a link to a preinstalled copy of the mingw directory, you can use it directly from that, it sin self extracting format. Yes type it exactly as I did including the path= and the % signs.

You will have to do that every time you open a new dos box, unless you permanently add it tot ehpath variable through teh settigns menu as laserlight mentioned.



Commandline or non-IDE compilation is clearly the worst thing ever invented! >.<

BLASPHEMER!!!!!


:)

cyberfish
01-21-2009, 07:48 PM
I do indeed find no problems with the nuwen build. It used to include newer GCC (but I think the official distribution has been updated to 4.x, too) than the official distro. Another thing I like about it is that it includes a few common libraries - Boost, SDL, etc. Saves some time.