QtBitcoinTrader找不到sayText方法

时间:2016-06-18 20:27:20

标签: c++ qt bitcoin

我正在尝试编译QT Bitcoin Trader,但由于某些原因,在配置openssl后,我的方法出错了。

qtBitcoinTrader.cpp

void QtBitcoinTrader::sayText(QString text)
{
    Q_UNUSED(text)
#ifdef Q_OS_MAC
    static SpeechChannel voiceChannel;
    static bool once=true;
    if(once)
    {
        once=false;
        NewSpeechChannel((VoiceSpec*)NULL, &voiceChannel);
    }
    CFStringRef talkText=CFStringCreateWithCharacters(0,reinterpret_cast<const UniChar *>(text.unicode()), text.length());
    SpeakCFString(voiceChannel, talkText, NULL);
    CFRelease(talkText);
#else
#ifdef Q_OS_WIN
#ifdef SAPI_ENABLED
    static ISpVoice *pVoice=NULL;
    static HRESULT hr=CoCreateInstance(CLSID_SpVoice, NULL, CLSCTX_ALL, IID_ISpVoice, (void **)&pVoice);
    if(SUCCEEDED(hr))
    {
        pVoice->Speak(NULL,SPF_PURGEBEFORESPEAK,0);
        pVoice->Speak((LPCWSTR)text.utf16(), SPF_ASYNC, NULL);
    }
#endif
#else
    startApplication("say",QStringList()<<text);
#endif
#endif
}

错误日志

Undefined symbols for architecture x86_64:
  "_CFRelease", referenced from:
      QtBitcoinTrader::sayText(QString) in qtbitcointrader.o
  "_CFStringCreateWithCharacters", referenced from:
      QtBitcoinTrader::sayText(QString) in qtbitcointrader.o
  "_NewSpeechChannel", referenced from:
      QtBitcoinTrader::sayText(QString) in qtbitcointrader.o
  "_SpeakCFString", referenced from:
      QtBitcoinTrader::sayText(QString) in qtbitcointrader.o
  "_inflate", referenced from:
      JulyHttp::uncompress(QByteArray*) in julyhttp.o
  "_inflateEnd", referenced from:
      JulyHttp::uncompress(QByteArray*) in julyhttp.o
  "_inflateInit2_", referenced from:
      JulyHttp::uncompress(QByteArray*) in julyhttp.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [DemoProject.app/Contents/MacOS/DemoProject] Error 1
03:03:20: The process "/usr/bin/make" exited with code 2.
Error while building/deploying project DemoProject (kit: Desktop Qt 5.6.0 clang 64bit)
When executing step "Make"

是否存在验证我是否错误引用库的方法?

1 个答案:

答案 0 :(得分:0)

您尚未在构建中添加ApplicationServicesCoreFoundation框架,并且您也错过了系统libz。将以下内容添加到.pro文件中,然后重新运行qmake并再次构建:

LIBS += -framework ApplicationServices -framework CoreFoundation -lz