静态QT未解析的外部符号

时间:2016-12-02 20:13:39

标签: c++ 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 &)" (?addTTFile@QBasicFontDatabase@@SA?AVQStringList@@ABVQByteArray@@0@Z)
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 *)" (?init@QFontEngineFT@@QAE_NUFaceId@QFontEngine@@_NW4GlyphFormat@3@PAVQFreetypeFace@@@Z)
Error LNK2019: unresolved external symbol _FT_Load_Sfnt_Table referenced in function "bool __cdecl ft_getSfntTable(void *,unsigned int,unsigned char *,unsigned int *)" (?ft_getSfntTable@@YA_NPAXIPAEPAI@Z)
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>)" (?addGlyphsToPath@QFontEngineFT@@UAEXPAIPAUQFixedPoint@@HPAVQPainterPath@@V?$QFlags@W4RenderFlag@QTextItem@@@@@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>)" (?addGlyphsToPath@QFontEngineFT@@UAEXPAIPAUQFixedPoint@@HPAVQPainterPath@@V?$QFlags@W4RenderFlag@QTextItem@@@@@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 " (?loadGlyph@QFontEngineFT@@QBEPAUGlyph@1@PAUQGlyphSet@1@IUQFixed@@W4GlyphFormat@QFontEngine@@_N@Z)
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 " (?loadGlyph@QFontEngineFT@@QBEPAUGlyph@1@PAUQGlyphSet@1@IUQFixed@@W4GlyphFormat@QFontEngine@@_N@Z)
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 " (?loadGlyph@QFontEngineFT@@QBEPAUGlyph@1@PAUQGlyphSet@1@IUQFixed@@W4GlyphFormat@QFontEngine@@_N@Z)
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 " (?loadGlyph@QFontEngineFT@@QBEPAUGlyph@1@PAUQGlyphSet@1@IUQFixed@@W4GlyphFormat@QFontEngine@@_N@Z)
Error LNK2019: unresolved external symbol _FT_MulFix referenced in function "public: bool __thiscall QFontEngineFT::init(struct QFontEngine::FaceId,bool,enum QFontEngine::GlyphFormat,class QFreetypeFace *)" (?init@QFontEngineFT@@QAE_NUFaceId@QFontEngine@@_NW4GlyphFormat@3@PAVQFreetypeFace@@@Z)
Error LNK2019: unresolved external symbol _FT_MulDiv referenced in function "void __cdecl scaleOutline(struct FT_FaceRec_ *,struct FT_GlyphSlotRec_ *,long,long)" (?scaleOutline@@YAXPAUFT_FaceRec_@@PAUFT_GlyphSlotRec_@@JJ@Z)
Error LNK2019: unresolved external symbol _FT_Get_Char_Index referenced in function "public: virtual unsigned int __thiscall QFontEngineFT::glyphIndex(unsigned int)const " (?glyphIndex@QFontEngineFT@@UBEII@Z)
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 &)" (?getFace@QFreetypeFace@@SAPAV1@ABUFaceId@QFontEngine@@ABVQByteArray@@@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 " (?loadGlyph@QFontEngineFT@@QBEPAUGlyph@1@PAUQGlyphSet@1@IUQFixed@@W4GlyphFormat@QFontEngine@@_N@Z)
Error LNK2019: unresolved external symbol _FT_Get_Postscript_Name referenced in function "public: struct QFontEngine::Properties __thiscall QFreetypeFace::properties(void)const " (?properties@QFreetypeFace@@QBE?AUProperties@QFontEngine@@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>)" (?addGlyphsToPath@QFontEngineFT@@UAEXPAIPAUQFixedPoint@@HPAVQPainterPath@@V?$QFlags@W4RenderFlag@QTextItem@@@@@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 &)" (?getFace@QFreetypeFace@@SAPAV1@ABUFaceId@QFontEngine@@ABVQByteArray@@@Z)
Error LNK2019: unresolved external symbol _FT_Select_Size referenced in function "public: void __thiscall QFreetypeFace::computeSize(struct QFontDef const &,int *,int *,bool *)" (?computeSize@QFreetypeFace@@QAEXABUQFontDef@@PAH1PA_N@Z)
Error LNK2019: unresolved external symbol _FT_Done_FreeType referenced in function "public: __thiscall QtFreetypeData::~QtFreetypeData(void)" (??1QtFreetypeData@@QAE@XZ)
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 &)" (?getFace@QFreetypeFace@@SAPAV1@ABUFaceId@QFontEngine@@ABVQByteArray@@@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 &)" (?addTTFile@QBasicFontDatabase@@SA?AVQStringList@@ABVQByteArray@@0@Z)
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 &)" (?addTTFile@QBasicFontDatabase@@SA?AVQStringList@@ABVQByteArray@@0@Z)
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 &)" (?addTTFile@QBasicFontDatabase@@SA?AVQStringList@@ABVQByteArray@@0@Z)
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 *)" (?getUnscaledGlyph@QFontEngineFT@@UAEXIPAVQPainterPath@@PAUglyph_metrics_t@@@Z)
Error LNK1120: 24 unresolved externals

我正在使用这些库:

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

你们任何人都可以解释一下我做错了什么吗?谢谢。

2 个答案:

答案 0 :(得分:2)

我遇到了完全相同的问题。你错过了freetype库qtfreetype.lib。 将以下行添加到.pro文件

LIBS += -lqtfreetype

答案 1 :(得分:0)

至少你需要QtCore和QtGui。 QString在QtCore中,QGuiApplication在QtGui中。如果您的Qt使用仅限于用户界面活动,那可能就足够了。否则,对于每个无法链接的课程,请查看Qt助手。 &#34; qmake&#34;请注意页面顶部说明哪个库包含该类。

例如,对于Qstring,它有&#34; qmake:QT + = core&#34;。对于Windows上的Visual Studio,&#34; core&#34;的实际文件名。库是Qt5Core.dll(发布)Qt5Cored.dll(调试)。