# Setting Up Your Project

Before using quickfix, you must make sure that your project has build settings that are compatible. Being a portable piece of code, some tradeoffs needed to be made concerning the areas of portability, maintainability, performance, testability, and features.

QuickFIX makes use of many advanced features of C++ that help and hinder some of these areas. We believe that for QuickFIX to be the best product it could be, the use of templates, exceptions, and the STL were important in most elegantly expressing the logic and data of a FIX engine. Therefore it is necessary that your compiler support these features. Most modern compilers will have no problem however there are some caveats which will be listed in the following sections.

- Windows (C++)
- Windows (.NET)
- Linux/Solaris (C++)
- Java

### Windows (C++)

The following settings concerning quickfix can all be found under the project | properties dialog box in Microsoft Visual Studio. All pages in this dialog box are organized by tabs and catagories. When refering to a setting, the format tab | catagory | setting will be used.

- C/C++ | Optimization | Optimization, can be set to whatever you prefer. The quickfix library by default is built with Maximize Speed but your project does not need to use the same setting.
- C/C++ | Code Generation | Enable C++ Exceptions, should be Yes.
- C/C++ | Code Generation | Runtime Library, should be set to Multithreaded DLL or Debug Multithreaded DLL. If you want to use a different setting, you must rebuild QuickFIX with the same setting. QuickFIX cannot currently be built single threaded.
- C/C++ | General | Additional Include Directories, must have a directory for accessing the QuickFIX header files. We reccomend setting this to a couple directories above the header files so your includes can look like #include <quickfix/Application.h>. This helps resolves ambiguities between your application and other third party libraries.
- Linker | Input | Additional Dependencies, must contain the quickfix.lib file. It must also have ws2_32.lib. This library links the winsock library into your application.
- Linker | General | Additional Library Directories, must have the directory where quickfix.lib resides.

### Windows (.NET)

This couldn't be simpler.

- Add the quickfix_net.dll and quickfix_net_message.dll to the references section of your projects.

### Linux/Solaris

Linux/Solaris have several caveats. Using GCC you have to keep a couple things in mind. Support for C++ is adequate but not great. The unix world is still primarily driven by C and therefore the tools are more readily available and optimized for C. Although everything builds and works correctly under Linux and Solaris, there are a few things to keep in mind.

- Because GCC isn't particularly optimized for C++ code, GCC compiled code tends to be slower than code compiled by some of the commercially available compilers. If you feel you need more performance, you may want to try one of these compilers. If you do this, please run the unit tests and acceptance tests to verify everything works as it should. We only currently do our testing with GCC.
- STL implementations that come with Versions of GCC 2.95.x, are not safe for use on multi-processor machines. Use STLport or upgrade to a version 3.x.x. STLport also tends to be faster then the implementation that comes with GCC.

There are a lot of choices for how to build under a unix environment. We use GNU autotools, however a lot of people don't. Instead of going over setting up an autotools project (a complex topic that I could not do justice here), I will simply cover what parameters need to be passed into your compiler and linker.

- Exceptions must be enabled with -fexceptions
- The -finline-functions optimization is recommended. Much of quickfix is in templates declared in header files. Allowing the compiler to inline some of these functions can help to optimize many frequent calls.
- Quickfix library must be linked in with -lquickfix
- Quickfix makes use of pthreads and libxml. These must be linked in with -lpthread, -lxml2 and -lz
- In addition to the above, on Solaris you must link with -lnsl and -lsocket
  NB: GNU `ld` is a one-pass linker, so order is important. Put more generally useful libraries (libsocket) last on the command line.

The actual placement of the quickfix library and header files should have been done for you when you ran make install after building quickfix.

### Java

The QuickFIX/J jar file has been provided for your convenience. It is recommended you download the full QuickFIX/J projects from www.quickfixj.org.

- When compiling, make sure quickfixj.jar is in your classpath.