我从他们的官方GitHub存储库下载了QuickFix,并按照安装它的说明进行操作。
我做了这个步骤:
./bootstrap
./configure
make
make check
sudo make install
使用CLion我创建了一个新项目,并复制了" tradeclient"样本开始。根据此文档http://www.quickfixengine.org/quickfix/doc/html/project.html,我提出了这个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")
现在我正在尝试运行QuickFix" tradeclient"示例,但我收到此错误:
[ 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
我使用的样本是:https://github.com/quickfix/quickfix/tree/master/examples/tradeclient
我的操作系统:macOS Sierra 10.12.6
处理器:64位
IDE使用的是:CLion
C ++编译器:g ++
已经问过类似的问题:Undefined symbols for architecture x86_64 buiding on Netbeans,我试图添加:
set(CMAKE_CXX_COMPILER g++)
set(CMAKE_CXX_FLAGS -m64)
给了我同样的错误
set(CMAKE_CXX_COMPILER g++)
set(CMAKE_CXX_FLAGS -m32)
这给了我几乎相同的错误但是:
Undefined symbols for architecture i386:
我猜我没有正确安装,或者我没有链接一些必要的库。我做错了什么?
答案 0 :(得分:0)
我使用了错误的编译器。这解决了我的问题:
C编译器:/Applications/Xcode.app/Contents/Developer/usr/bin/gcc
C ++编译器:/Applications/Xcode.app/Contents/Developer/usr/bin/g++