How can I make the login part in QuickFIX in c++? I found tons of tutorials and articles on how to do this on c# or java, but nothing on c++.

I have a server (acceptor), and a client (initiator). The username and password of the client are stored in the settings file, and are hardcoded in the server program.

From what I've read in the client I set the username and password in fromAdmin() and read and check the in the server in the toAdmin(), but how do I do that?

Here's what I've tried so far:

  • cast the message to a FIX44::Logon& object using:

    FIX44::Logon& logon_message = dynamic_cast<FIX44::Logon&>(message);
    
  • Set the Username and password to the logon object like this:

    if(session_settings.has("Username"))
    {
        FIX::Username username = session_settings.getString("Username");
        logon_message.set(username);
    }
    
  • And send the message like this:

    FIX::Message messageToSend = logon_message;
    FIX::Session::sendToTarget(messageToSend);
    

But I get this error on the cast:

cannot dynamic_cast 'message' (of type 'class FIX::Message') to type 'struct FIX44::Logon&' (target is not pointer or reference to complete type)

What I've tried I got inspired from http://niki.code-karma.com/2011/01/quickfix-logon-support-for-username-password/comment-page-1/.

I'm still not clear on how to make the client and the server.

Can anyone help me?

Edit
Report