QtBitcoinTrader 找不到 sayText 方法
QtBitcoinTrader cannot find sayText method
我正在尝试编译 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"
有没有一种方法可以验证我是否错误地引用了库?
您还没有将 ApplicationServices
和 CoreFoundation
框架添加到您的构建中,并且您也缺少系统 libz。将以下内容添加到 .pro
文件中,然后重新 运行 qmake 并再次构建:
LIBS += -framework ApplicationServices -framework CoreFoundation -lz
我正在尝试编译 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"
有没有一种方法可以验证我是否错误地引用了库?
您还没有将 ApplicationServices
和 CoreFoundation
框架添加到您的构建中,并且您也缺少系统 libz。将以下内容添加到 .pro
文件中,然后重新 运行 qmake 并再次构建:
LIBS += -framework ApplicationServices -framework CoreFoundation -lz