Installing gcc for -gen gcc

FreeBASIC

Installing gcc for -gen gcc
 
Windows 32bit

If you are using the FreeBASIC-x.xx.x-win32 package, you can use our pre-made gcc package. Download gcc-x.x.x-for-FB-win32-gengcc.zip from the Binaries - Windows/More/ directory at the fbc downloads area, and extract it into the FreeBASIC installation directory (where fbc.exe is), such that gcc.exe and cc1.exe will be placed in these locations:

  • bin\win32\gcc.exe
  • bin\libexec\gcc\i686-w64-mingw32\x.x.x\cc1.exe

You can also download Win32 versions of gcc directly from the MinGW.org or MinGW-w64 projects.

Windows 64bit

The FreeBASIC-x.xx.x-win64 package already comes with gcc included, and uses -gen gcc by default (because -gen gas does not support 64bit).

DOS

It requires a (minimal) DJGPP installation. DJGPP can be downloaded from the DJGPP website. At least the djdev*.zip and gcc*b.zip are needed. In order to run the DJGPP gcc, the DJGPP environment variable must be set to point to the djgpp.env file.

To use the DJGPP gcc with the FreeBASIC-x.xx.x-dos package, copy gcc.exe and cc1.exe into the FreeBASIC installation directory, such that they will be placed in these locations:

  • bin\dos\gcc.exe
  • bin\libexec\gcc\djgpp\x.xx\cc1.exe

Linux

Typically the gcc package is already installed, or it can be installed by doing something like:
sudo apt-get install gcc
(the exact command depends on your GNU/Linux distribution)

Non-standalone fbc installed into DJGPP/MinGW toolchains

If you are using a non-standalone version of fbc (e.g. from one of the fbc-x.xx.x-win32 packages), and have it installed inside a DJGPP or MinGW toolchain, then -gen gcc should already work, as the DJGPP or MinGW toolchains provide gcc.

As long as gcc.exe is in the same directory as fbc.exe (typically C:\DJGPP\bin\ or C:\MinGW\bin\), or available in the PATH environment variable, fbc.exe should be able to find and use it.

See also