1

I downloaded QuickFix from their official GitHub repository, and following the instructions installed it.

I made this steps:

./bootstrap 
./configure  
make   
make check  
sudo make install

Using CLion I created a new project, and copied the "tradeclient" sample to get started. According this documentation http://www.quickfixengine.org/quickfix/doc/html/project.html I came up with this CMakeList:

cmake_minimum_required(VERSION 3.9)
project(quickFixClient)

set(CMAKE_CXX_STANDARD 11)

add_executable(quickFixClient tradeclient.cpp)

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -lquickfix")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -lpthread")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -lxml2")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -lz")

Now am trying to run the QuickFix "tradeclient" sample, but I am getting this error :

[ 50%] Linking CXX executable quickFixClient
Undefined symbols for architecture x86_64:
  "Application::run()", referenced from:
      _main in tradeclient.cpp.o
  "FIX::SessionSettings::SessionSettings(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)", referenced from:
      _main in tradeclient.cpp.o
  "vtable for Application", referenced from:
      _main in tradeclient.cpp.o
      Application::~Application() in tradeclient.cpp.o
  NOTE: a missing vtable usually means the first non-inline virtual member function has no definition.
ld: symbol(s) not found for architecture x86_64
collect2: error: ld returned 1 exit status
make[3]: *** [quickFixClient] Error 1
make[2]: *** [CMakeFiles/quickFixClient.dir/all] Error 2
make[1]: *** [CMakeFiles/quickFixClient.dir/rule] Error 2
make: *** [quickFixClient] Error 2

The sample I am using is : https://github.com/quickfix/quickfix/tree/master/examples/tradeclient

My operation system : macOS Sierra 10.12.6

Processor : 64 bit

The IDE am using is : CLion

C++ compiler : g++

A similar question was already asked : Undefined symbols for architecture x86_64 buiding on Netbeans, and I tried to add:

set(CMAKE_CXX_COMPILER g++)
set(CMAKE_CXX_FLAGS -m64)

which gives me the same error

set(CMAKE_CXX_COMPILER g++)
set(CMAKE_CXX_FLAGS -m32)

which gives me almost the same error but with :

Undefined symbols for architecture i386:

I am guessing that I am not doing the installation right, or I do not link some necessary libraries. What I am doing wrong ?

Biffen
  • 6,249
  • 6
  • 28
  • 36
πter
  • 1,899
  • 2
  • 9
  • 23
  • Possible duplicate of [What is an undefined reference/unresolved external symbol error and how do I fix it?](https://stackoverflow.com/questions/12573816/what-is-an-undefined-reference-unresolved-external-symbol-error-and-how-do-i-fix) – Biffen Feb 20 '18 at 08:45

1 Answers1

0

I was using wrong compilers. This fixed my problem :

C compiler : /Applications/Xcode.app/Contents/Developer/usr/bin/gcc

C++ compiler: /Applications/Xcode.app/Contents/Developer/usr/bin/g++

πter
  • 1,899
  • 2
  • 9
  • 23