# Building the Windows Binaries

To build Tix on Windows, you must have the following:

- Visual C++ 4.0 or later; or Borland C++ 4.5 or later. There is not yet built-in support for Tix to work with other compilers.
- The sources of Tcl/Tk for Windows.
- The sources of Tix for Windows.

### 1. Download the Tcl, Tk and Tix sources

You can download latest version of the Tcl8.0, 8.1 8.2 or 8.3 from ftp://ftp.scriptics.com/pub . There are detailed instructions that comes with these packages about compiling them on Windows. Hopefully that will give you a good exercise on setting up the environment for compiling Tcl-based programs on the Windows platforms.

You can then get the Tix source distribution at http://tix.sourceforget.net/download.html. The ZIP file contains files with long file names and must be unzipped by an UNZIP program that knows long filenames, such as winzip.exe.

You should put the Tcl, Tk and Tix source packages in the same directory. For example, my directories look like this:

> `C:\Program Files\tcl8.3.5
> C:\Program Files\tk8.3.5
> C:\Program Files\tix-8.1.4
> `

### 2. Compile Tcl and Tk

Follow the instructions that come with Tcl and Tk. If you can compile successfully, you would get the following files:

> `C:\Program Files\tcl8.3.5\win\Release\tcl83.dll
> C:\Program Files\tcl8.3.5\win\Release\\tclpip83.dll
> C:\Program Files\tk8.3.5\win\Release\\tk83.dll
> `

These are the files you need to run Tix on Windows.

### 3. Compile Tix

Change to the tix-8.1.4\Win subdirectory. Tix supports several versions of Tcl.

1. Versions of Tcl/Tk prior to 8.0 are no longer supported.
2. The makefile.bc is for Borland 4.5/5.x, The makefile.vc4 is for MSVC 4.x, The makefile.vc4 is for MSVC 5.x and 6.x
3. Edit the file "common.mak" set set the common settings: TCL_VER = version of Tcl to compile with. Should be either 8.0 8.1 8.2 or 8.3. You may also have to set the Tk/Tcl patchlevel TCLPATCH.

For MSVC++, use: nmake -f makefile.vc If you have BC++, use: make -f makefile.bc instead.

When make or nmake finishes, you will get Tix binaries inside the build directories. For example, if you compile Tix for Tcl 8.0, you will be the following files:

> `C:\Program Files\tix-8.1.4\win\tcl8.0\tix8183.dll
> C:\Program Files\tix-8.1.4\win\tcl8.0\tix8183.exe
> `

The executable file tix831.exe contains Tcl, Tk and Tix. You can use it to run an Tix script by:

> `set TIX_LIBRARY=C:\Program Files\tix-8.1.4\library C:\Program Files\tix-8.1.4\win\tcl8.0\tix8183.exe foo.tcl
> `

### 4. Fixing DLL problems

You may run into certain problems related to DLL's when you execute tix8183.exe. For example:

- Windows complains that a DLL, usually tcl83.dll, is not found.
- Windows complains that a symbol is missing.
- Some weird things happen.

When tix8183.exe starts up, it will load in the following DLL's

- `tcl83.dll`
- `tclpip83.dll`
- `tk83.dll`
- `tix8183.dll`

Windows searches for a DLL file by the following order:

1. Same directory as executable.
2. Windows system directory.
3. directories in the PATH environment variable.

To ensure that the correct DLLs are loaded, you can copy all the DLL's used by tix8183.exe into the directory where tix8183.exe is.

### 5. Installing Tix

You can install Tix into the Tcl installation directory so that you can load Tix with the "package require" command and no longer need to set the TIX_LIBRARY variable:

1. Create a directory tix-8.1 under the Tcl installation directory, usually in C:\Program Files\tcl8.3.5\lib.

2. Copy all the files under tix-8.1.4\library into the C:\Program Files\tcl8.3.5\lib\tix-8.1 directory.

3. Copy the file tix-8.1.4\win\pkgIndex.tcl into the C:\Program Files\tcl8.3.5\lib\tix-8.1 directory.

Now you should be able to start up wish83.exe and execute the following command to load in Tix.

> `package require Tix`

Read the file tix-8.1.4\docs\Pkg.txt for more info about dynamically loading Tix.

### FAQ's for running Tix on Windows

How do I set an environment variable.

  You can set it in your DOS window by typing something like "set TIX_LIBRARY=C:\Program Files\tix-8.1.4\library". This will affect that particular DOS window only. If you want the change to affect the whole Windows environment (for example, you want launch tix8183.exe by double-clicking on its icon), you must put the commands in your AUTOEXEC.BAT file and then reboot your machine.

I get an "out of environment space" error from DOS.

  Edit your CONFIG.SYS file and add the switch "/E:1024" to the SHELL=COMMAND.COM line. Reboot. This should give you enough env space.

My C compiler says "unrecognized file format tk83.lib" or something like that.

  You compiled tk83.lib with VC++ and are compiling Tix with Borland C++, or vice versa. Use the same compiler to compile all binaries.