2016-06-18 27 views
1

我試圖編譯QT Bitcoin Trader,但由於某種原因配置了openssl之後,我得到了自己的方法出錯。QtBitcoinTrader找不到sayText方法

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" 

存在的方法來驗證,如果我錯了引用庫?

回答

0

您還沒有將ApplicationServicesCoreFoundation框架添加到您的構建中,並且您也缺少系統libz。將以下內容添加到.pro文件中,然後重新運行qmake並重新構建:

LIBS += -framework ApplicationServices -framework CoreFoundation -lz