2016-12-02 149 views
0

我一直在嘗試使用靜態qt構建一段時間,但我無法擺脫這些錯誤。靜態QT無法解析的外部符號

 <QtGuiApplication4> (29 items) 
Error LNK2019: unresolved external symbol _FT_New_Face referenced in function "public: static class QStringList __cdecl QBasicFontDatabase::addTTFile(class QByteArray const &,class QByteArray const &)" ([email protected]@@[email protected]@[email protected]@[email protected]) 
Error LNK2019: unresolved external symbol _FT_Get_PS_Font_Info referenced in function "public: bool __thiscall QFontEngineFT::init(struct QFontEngine::FaceId,bool,enum QFontEngine::GlyphFormat,class QFreetypeFace *)" ([email protected]@@[email protected]@@[email protected]@[email protected]@@Z) 
Error LNK2019: unresolved external symbol _FT_Load_Sfnt_Table referenced in function "bool __cdecl ft_getSfntTable(void *,unsigned int,unsigned char *,unsigned int *)" ([email protected]@[email protected]) 
Error LNK2019: unresolved external symbol _FT_GlyphSlot_Oblique referenced in function "public: virtual void __thiscall QFontEngineFT::addGlyphsToPath(unsigned int *,struct QFixedPoint *,int,class QPainterPath *,class QFlags<enum QTextItem::RenderFlag>)" ([email protected]@@[email protected]@[email protected]@[email protected]@[email protected]@@@@Z) 
Error LNK2019: unresolved external symbol _FT_GlyphSlot_Embolden referenced in function "public: virtual void __thiscall QFontEngineFT::addGlyphsToPath(unsigned int *,struct QFixedPoint *,int,class QPainterPath *,class QFlags<enum QTextItem::RenderFlag>)" ([email protected]@@[email protected]@[email protected]@[email protected]@[email protected]@@@@Z) 
Error LNK2019: unresolved external symbol _FT_Outline_Get_Bitmap referenced in function "public: struct QFontEngineFT::Glyph * __thiscall QFontEngineFT::loadGlyph(struct QFontEngineFT::QGlyphSet *,unsigned int,struct QFixed,enum QFontEngine::GlyphFormat,bool)const " ([email protected]@@[email protected]@[email protected]@[email protected]@[email protected]@@[email protected]) 
Error LNK2019: unresolved external symbol _FT_Outline_Transform referenced in function "public: struct QFontEngineFT::Glyph * __thiscall QFontEngineFT::loadGlyph(struct QFontEngineFT::QGlyphSet *,unsigned int,struct QFixed,enum QFontEngine::GlyphFormat,bool)const " ([email protected]@@[email protected]@[email protected]@[email protected]@[email protected]@@[email protected]) 
Error LNK2019: unresolved external symbol _FT_Outline_Translate referenced in function "public: struct QFontEngineFT::Glyph * __thiscall QFontEngineFT::loadGlyph(struct QFontEngineFT::QGlyphSet *,unsigned int,struct QFixed,enum QFontEngine::GlyphFormat,bool)const " ([email protected][email protected]@[email protected]@[email protected]@[email protected]@[email protected]@@[email protected]) 
Error LNK2019: unresolved external symbol _FT_Vector_Transform referenced in function "public: struct QFontEngineFT::Glyph * __thiscall QFontEngineFT::loadGlyph(struct QFontEngineFT::QGlyphSet *,unsigned int,struct QFixed,enum QFontEngine::GlyphFormat,bool)const " ([email protected]@@[email protected]@[email protected]@[email protected]@[email protected]@@[email protected]) 
Error LNK2019: unresolved external symbol _FT_MulFix referenced in function "public: bool __thiscall QFontEngineFT::init(struct QFontEngine::FaceId,bool,enum QFontEngine::GlyphFormat,class QFreetypeFace *)" ([email protected]@@[email protected]@@[email protected]@[email protected]@@Z) 
Error LNK2019: unresolved external symbol _FT_MulDiv referenced in function "void __cdecl scaleOutline(struct FT_FaceRec_ *,struct FT_GlyphSlotRec_ *,long,long)" ([email protected]@[email protected]@[email protected]@[email protected]) 
Error LNK2019: unresolved external symbol _FT_Get_Char_Index referenced in function "public: virtual unsigned int __thiscall QFontEngineFT::glyphIndex(unsigned int)const " ([email protected]@@[email protected]) 
Error LNK2019: unresolved external symbol _FT_Set_Charmap referenced in function "public: static class QFreetypeFace * __cdecl QFreetypeFace::getFace(struct QFontEngine::FaceId const &,class QByteArray const &)" ([email protected]@@[email protected]@[email protected]@[email protected]@@Z) 
Error LNK2019: unresolved external symbol _FT_Matrix_Multiply referenced in function "public: struct QFontEngineFT::Glyph * __thiscall QFontEngineFT::loadGlyph(struct QFontEngineFT::QGlyphSet *,unsigned int,struct QFixed,enum QFontEngine::GlyphFormat,bool)const " ([email protected]@@[email protected]@[email protected]@[email protected]@[email protected]@@[email protected]) 
Error LNK2019: unresolved external symbol _FT_Get_Postscript_Name referenced in function "public: struct QFontEngine::Properties __thiscall QFreetypeFace::properties(void)const " ([email protected]@@[email protected]@@XZ) 
Error LNK2019: unresolved external symbol _FT_Load_Glyph referenced in function "public: virtual void __thiscall QFontEngineFT::addGlyphsToPath(unsigned int *,struct QFixedPoint *,int,class QPainterPath *,class QFlags<enum QTextItem::RenderFlag>)" ([email protected]@@[email protected]@[email protected]@[email protected]@[email protected]@@@@Z) 
Error LNK2019: unresolved external symbol _FT_Set_Char_Size referenced in function "public: static class QFreetypeFace * __cdecl QFreetypeFace::getFace(struct QFontEngine::FaceId const &,class QByteArray const &)" ([email protected]@@[email protected]@[email protected]@[email protected]@@Z) 
Error LNK2019: unresolved external symbol _FT_Select_Size referenced in function "public: void __thiscall QFreetypeFace::computeSize(struct QFontDef const &,int *,int *,bool *)" ([email protected]@@[email protected]@[email protected]) 
Error LNK2019: unresolved external symbol _FT_Done_FreeType referenced in function "public: __thiscall QtFreetypeData::~QtFreetypeData(void)" ([email protected]@[email protected]) 
Error LNK2019: unresolved external symbol _FT_Init_FreeType referenced in function "public: static class QFreetypeFace * __cdecl QFreetypeFace::getFace(struct QFontEngine::FaceId const &,class QByteArray const &)" ([email protected]@@[email protected]@[email protected]@[email protected]@@Z) 
Error LNK2001: unresolved external symbol _FT_Get_Sfnt_Table 
Error LNK2019: unresolved external symbol _FT_Get_Sfnt_Table referenced in function "public: static class QStringList __cdecl QBasicFontDatabase::addTTFile(class QByteArray const &,class QByteArray const &)" ([email protected]@@[email protected]@[email protected]@[email protected]) 
Error LNK2001: unresolved external symbol _FT_Done_Face 
Error LNK2019: unresolved external symbol _FT_Done_Face referenced in function "public: static class QStringList __cdecl QBasicFontDatabase::addTTFile(class QByteArray const &,class QByteArray const &)" ([email protected][email protected]@[email protected]@[email protected]@[email protected]) 
Error LNK2001: unresolved external symbol _FT_New_Memory_Face 
Error LNK2019: unresolved external symbol _FT_New_Memory_Face referenced in function "public: static class QStringList __cdecl QBasicFontDatabase::addTTFile(class QByteArray const &,class QByteArray const &)" ([email protected]@@[email protected]@[email protected]@[email protected]) 
Error LNK2001: unresolved external symbol _FT_New_Face 
Error LNK2019: unresolved external symbol _FT_Set_Transform referenced in function "public: virtual void __thiscall QFontEngineFT::getUnscaledGlyph(unsigned int,class QPainterPath *,struct glyph_metrics_t *)" ([email protected]@@[email protected]@[email protected]@@Z) 
Error LNK1120: 24 unresolved externals 

我使用這些庫:

ws2_32.lib 
imm32.lib 
winmm.lib 
qtharfbuzzng.lib 
qtpcre.lib 
Qt5PlatformSupport.lib 
qwindows.lib 
opengl32.lib 

任何你能解釋我什麼,我做錯了什麼?謝謝。

+1

Qt中沒有更多的.lib文件需要鏈接? – Steve

+0

從教程我跟着這應該是足夠的 –

+0

***從教程我跟着這應該是足夠***我說這是不夠的。 – drescherjm

回答

0

您至少需要QtCore和QtGui。 QString在QtCore中,而QGuiApplication在QtGui中。如果您的Qt使用僅限於用戶界面活動,那可能就足夠了。否則,對於每個無法鏈接的類,請查看Qt助手。頁面頂部的「qmake」註釋指出哪個庫包含該類。

例如,對於Qstring,它有「qmake:QT + = core」。對於Windows上的Visual Studio,「核心」庫的實際文件名是Qt5Core.dll(發行版)Qt5Cored.dll(調試)。

1

我有完全相同的問題。您錯過了freetype庫qtfreetype.lib。 將以下行添加到.pro文件中

LIBS += -lqtfreetype