Setting Up Your Project

This guide explains how to link QuickFIX into your application.

Using CMake (Recommended)

The easiest way to use QuickFIX in your project is with CMake's find_package:

# In your CMakeLists.txt
find_package(quickfix REQUIRED)

add_executable(myapp main.cpp)
target_link_libraries(myapp quickfix)

If QuickFIX is installed in a non-standard location, set CMAKE_PREFIX_PATH to the installation directory.



Windows with Visual Studio

When using Visual Studio without CMake, configure your project manually:

Project Properties

With SSL Support

If using SSL/TLS features, also add OpenSSL libraries:

With Database Support

If using database message stores, add the appropriate client library:



Linux / macOS / Unix

Compiler Flags

Linking

Link against QuickFIX and required system libraries:

g++ -std=c++17 myapp.cpp -o myapp -lquickfix -lpthread

With SSL Support

g++ -std=c++17 myapp.cpp -o myapp -lquickfix -lpthread -lssl -lcrypto

With MySQL Support

g++ -std=c++17 myapp.cpp -o myapp -lquickfix -lpthread $(mysql_config --libs)

With PostgreSQL Support

g++ -std=c++17 myapp.cpp -o myapp -lquickfix -lpthread -lpq

Platform-Specific Notes

macOS

On macOS, use the system Clang compiler:

clang++ -std=c++17 myapp.cpp -o myapp -lquickfix -lpthread

Linker Order

Note: GNU ld is a one-pass linker. Place more generally useful libraries (like -lpthread) after more specific libraries on the command line.



Include Files

In your C++ source files, include QuickFIX headers as follows:

#include "quickfix/Application.h"
#include "quickfix/MessageCracker.h"
#include "quickfix/Values.h"
#include "quickfix/Mutex.h"

// For specific FIX versions
#include "quickfix/fix44/NewOrderSingle.h"
#include "quickfix/fix44/ExecutionReport.h"


Minimal Example

Here's a minimal example of a QuickFIX application:

#include "quickfix/Application.h"
#include "quickfix/MessageCracker.h"
#include "quickfix/SessionSettings.h"
#include "quickfix/FileStore.h"
#include "quickfix/FileLog.h"
#include "quickfix/SocketAcceptor.h"

class MyApplication : public FIX::Application
{
public:
    void onCreate(const FIX::SessionID&) override {}
    void onLogon(const FIX::SessionID&) override {}
    void onLogout(const FIX::SessionID&) override {}
    void toAdmin(FIX::Message&, const FIX::SessionID&) override {}
    void toApp(FIX::Message&, const FIX::SessionID&) override {}
    void fromAdmin(const FIX::Message&, const FIX::SessionID&) override {}
    void fromApp(const FIX::Message&, const FIX::SessionID&) override {}
};

int main(int argc, char** argv)
{
    FIX::SessionSettings settings("config.cfg");
    MyApplication application;
    FIX::FileStoreFactory storeFactory(settings);
    FIX::FileLogFactory logFactory(settings);
    FIX::SocketAcceptor acceptor(application, storeFactory, settings, logFactory);

    acceptor.start();
    // Wait for Ctrl-C or termination signal
    acceptor.block();
    acceptor.stop();

    return 0;
}

See the examples/ directory for more complete applications.