c++qtquick2quickfix

QuickFix C++ - How to established Trading session from client APP?


I have build my quickfix C++ source code with the SSL support using below command. My quickfix library got build successfully.

On Linux (with system openssl),

cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DHAVE_SSL=ON -DCMAKE_INSTALL_PREFIX:PATH="install-path" .. make -j 4 install

This is my Initiator code -

if (isSSL.compare("SSL") == 0)
    initiator = new FIX::ThreadedSSLSocketInitiator ( application, storeFactory, settings, logFactory );
else
    initiator = new FIX::SocketInitiator( application, storeFactory, settings, logFactory );

But while running this getting linking issue. What is the problem ?

CMakeFiles/TradingClient.dir/tradeclient.cpp.o: In function `main':
/mnt/d/TradingClient/tradeclient.cpp:47: undefined reference to `FIX::ThreadedSSLSocketInitiator::ThreadedSSLSocketInitiator(FIX::Application&, FIX::MessageStoreFactory&, FIX::SessionSettings const&, FIX::LogFactory&)'
collect2: error: ld returned 1 exit status

This my CMakeLists.txt

cmake_minimum_required(VERSION 3.0)
project(TradingClient)

add_definitions(-DHAVE_SSL=1)

set(CMAKE_CXX_STANDARD 14)
set(quickfix_lib "/usr/lib/libquickfix.so")

add_executable(TradingClient Application.h Application.cpp tradeclient.cpp)
target_link_libraries(TradingClient ${quickfix_lib} )

if you go inside quickfix/src/C++/CMakeLists.txt

 if (HAVE_SSL)
  set (quickfix_SOURCES ${quickfix_SOURCES}
    SSLSocketAcceptor.cpp
    SSLSocketConnection.cpp
    SSLSocketInitiator.cpp
    ThreadedSSLSocketAcceptor.cpp
    ThreadedSSLSocketConnection.cpp
    ThreadedSSLSocketInitiator.cpp
    UtilitySSL.cpp)
endif()

these files get build only with SSL . It means my quickfix library is correctly build because object files for these files got generated.

Although object files gets generated as part of library, still getting this linking issue that its not able to find the reference for these methods ThreadedSSLSocketInitiator()


Solution

  • but this is not related to compilation issue .Its quickfix source code bug. I found one blog related to that this file has missing entry

    #cmakedefine HAVE_SSL 1
    

    I have added in this file

    cat cmake_config.h.in

    #ifndef CONFIG_H_IN 
    #define CONFIG_H_IN 
    
    #cmakedefine HAVE_EMX 
    #cmakedefine HAVE_CXX17 
    #cmakedefine HAVE_STD_SHARED_PTR 
    #cmakedefine HAVE_SHARED_PTR_IN_TR1_NAMESPACE 
    #cmakedefine HAVE_STD_TR1_SHARED_PTR_FROM_TR1_MEMORY_HEADER 
    #cmakedefine HAVE_STD_UNIQUE_PTR 
    #cmakedefine HAVE_SSL 1
    #endif