Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
163 lines (119 sloc) 5.8 KB
$ cd /opt/
$ tar xjf ooc-0.2-ninja.tar.bz2
$ ln -s /opt/ooc/bin/ooc /usr/bin/
$ ooc -V
If it prints the version number and the build date, you're all set ;)
Your next stop should be the examples folders, to familiarize yourself
with the language.
(/opt/ooc is just an example install location, but it's a good one.)
The ooc compiler has been run successfully under Gentoo, Ubuntu,
and Red Hat, but it should work just as well in other distributions.
You can report bugs to
WARNING: DON'T COPY THE EXECUTABLE. It will prevent the compiler from
locating its libraries (in sdk/, libs/, etc.). Make a symbolic link,
as shown above.
Windows + MinGW/MSYS
- Install the latest MinGW and MSYS packages from
- Extract ooc-0.2-ninja.tar.bz2, e.g. to C:\ooc\ (if you need an
(un)archiver program, check out
- Add C:\ooc\bin\ to your PATH, e.g.:
* Open "Control Panel -> System"
* Go in the "Advanced" tab
* Click on the "Environment variables" button
* Select "PATH" from the bottom list, and click on the "Edit" button
just below
* Add ";C:\ooc\bin" to the end of your PATH. The folder names are
separated with semi-colons (";")
- Open MSYS, type "ooc" and press Enter
If it prints the version number and the build date, you're all set ;)
Your next stop should be the examples folders, to familiarize yourself
with the language.
(C:\ooc\ is just an example install location, but it's a good one.
As a general rule, avoid spaces in path names, it could cause problem
with some tools.)
Windows CMD.exe
ooc also works under the regular windows shell. It guess its
location by reading the "Path" environment variable. If you
still have environment variable problems, you can temporarily
set it with "set OOC_DIST=C:\ooc" (for example)
You can report bugs concerning windows compatibility
OpenSolaris, Solaris
FreeBSD, NetBSD, OpenBSD
and other Java-supporting platforms
Since there are not yet binary builds for these operating systems,
you have to use the "jar distribution", (the one with bin/ooc.jar in it),
and you need a JRE (Java Runtime Environment) that supports Java 1.5 or more
to run ooc.
You can download Sun's JRE from
The jar is 'executable', which means you can run it with:
$ java -jar /opt/ooc/bin/ooc.jar arg1 arg2 arg3
It's recommended for everyday work to use a bash script in /usr/bin/
to launch ooc. There's an example of such a script in utils/
$ cp utils/ /usr/bin/ooc
$ vim /usr/bin/ooc
(edit the path of the script)
Haiku, Zeta, BeOS, etc.
There doesn't seem to be a stable Java distribution for the BeOS family.
However, with the work going on with OpenJDK 7 and Haiku, the situation
may change.
In the meantime, you can still use ooc! Just use another computer under
Linux/Windows, to translate to C99 source, export it (for example using
the make backend), and compile it with gcc on your Haiku machine. This
method has been tested with a gcc4 version of Haiku, and it worked very
For your convenience, there is a statically linkable version of libgc.a
built for Haiku/gcc4 in the libs/haiku/ directory.
64bit support
That is the great unknown. No tests have been made so far.
If you run a 64-bit os/kernel, please, please report any bugs on
- A C compiler (preferably GCC, or MinGW/GCC on Windows)
ooc is implemented in Java, but binaries compiled with GCJ are distributed.
These are statically linked, so isn't needed.
Q: I've got the message "ERROR: You need to set the OOC_DIST environment
variable to where you have installed ooc. (example: export OOC_DIST=/opt/ooc)"
A: Usually, ooc is smart enough to guess where it's installed and configures
all path itself. Unfortunately, sometimes it's too hard to guess, so you
have to help ooc a little bit by exporting your OOC_DIST variable. If you're
on Windows, you can adjust that in Control Panel -> System -> Advanced ->
Environment Variables -> New -> Name: OOC_DIST, Value: C:/ooc (for example)
Q: ooc says it can't find gcc in the path
A: Then your gcc hides well. You can help ooc by exporting the CC
environment variable, e.g. export CC=/usr/bin/i686-pc-linux-gnu-gcc
If you're on MinGW, you should probably add C:\MinGW\bin to your PATH.
You can do that in the Control panel, see the answer above as for
how to manipulate environment variables in Windows XP and above.
Q: ooc says it can't find the class OocLib.ooc
A: Then it has guessed OOC_DIST wrong. See the first answer up there.
Q: I wrote a file.ooc and compiled it with ooc but nothing happens!
A: Did you forget to add a main function ? (e.g. func main { /* ... */ })
ooc won't output any file if there are no main functions in the .ooc files
you ask it to compile.
Q: Why can't I see any .c/.h files? What happens to them during compilation?
A: By default, ooc creates an "ooc_tmp" directory, writes every .c/.h
file in it, asks gcc to compile it, copy the executables outside the
ooc_tmp directory, and removes the ooc_tmp directory. If you want
to see the ooc_tmp directory, call ooc with the -noclean option.
Q: The binary linux/windows version crashes/does funny stuff
A: Sorry for the inconvenience, you may want to try the .jar distribution.
See the Solaris/BSD etc. section above for instructions