freetype/config/ftheader.h: No such file or directory

今天在linux编译工程时,碰到如下错误:

/opt/mv_pro_4.0.1/montavista/pro/devkit/arm/v5t_le/bin/../target/usr/include/ft2build.h:56:38: freetype/config/ftheader.h: No such file or directory
xxx/FreetypeUtils.cpp:8:10: #include expects "FILENAME" or
xxx/FreetypeUtils.cpp:9:10: #include expects "FILENAME" or
Compiling: xxx/SWJpegBuffer.cpp
xxx/FreetypeUtils.cpp:56: error: `FT_Library' does not name a type
xxx/FreetypeUtils.cpp:65: error: `FT_Face' does not name a type
xxx/FreetypeUtils.cpp:77: error: ISO C++ forbids declaration of `FT_Bitmap' with no type
xxx/FreetypeUtils.cpp:77: error: expected `;' before '*' token
xxx/FreetypeUtils.cpp: In function `int FT_Init()':
xxx/FreetypeUtils.cpp:100: error: `FT_Error' undeclared (first use this function)
xxx/FreetypeUtils.cpp:100: error: (Each undeclared identifier is reported only once for each function it appears in.)
xxx/FreetypeUtils.cpp:100: error: expected `;' before "error"
xxx/FreetypeUtils.cpp:101: error: `error' undeclared (first use this function)
xxx/FreetypeUtils.cpp:117: error: `g_library' undeclared (first use this function)
xxx/FreetypeUtils.cpp:117: error: `FT_Library_Version' undeclared (first use this function)
xxx/FreetypeUtils.cpp: In function `void FT_Quit()':
xxx/FreetypeUtils.cpp:133: error: `g_library' undeclared (first use this function)
xxx/FreetypeUtils.cpp:133: error: `FT_Done_FreeType' undeclared (first use this function)
xxx/FreetypeUtils.cpp: In function `void FT_CloseFont(FT_Font*)':
xxx/FreetypeUtils.cpp:147: error: 'struct _FT_Font' has no member named 'face'
xxx/FreetypeUtils.cpp:149: error: 'struct _FT_Font' has no member named 'face'
xxx/FreetypeUtils.cpp:149: error: `FT_Done_Face' undeclared (first use this function)
xxx/FreetypeUtils.cpp: In function `FT_Font* FT_OpenFont(const char*, int)':
xxx/FreetypeUtils.cpp:172: error: `FT_Face' undeclared (first use this function)
xxx/FreetypeUtils.cpp:172: error: expected `;' before "face"
xxx/FreetypeUtils.cpp:173: error: `FT_Error' undeclared (first use this function)
xxx/FreetypeUtils.cpp:173: error: expected `;' before "error"
xxx/FreetypeUtils.cpp:174: error: `FT_Fixed' undeclared (first use this function)
xxx/FreetypeUtils.cpp:174: error: expected `;' before "scale"
xxx/FreetypeUtils.cpp:184: error: `error' undeclared (first use this function)
xxx/FreetypeUtils.cpp:184: error: `g_library' undeclared (first use this function)
xxx/FreetypeUtils.cpp:184: error: 'struct _FT_Font' has no member named 'face'
xxx/FreetypeUtils.cpp:184: error: `FT_New_Face' undeclared (first use this function)
xxx/FreetypeUtils.cpp:191: error: `face' undeclared (first use this function)
xxx/FreetypeUtils.cpp:191: error: 'struct _FT_Font' has no member named 'face'
xxx/FreetypeUtils.cpp:194: error: `FT_ENCODING_UNICODE' undeclared (first use this function)
xxx/FreetypeUtils.cpp:194: error: `FT_Select_Charmap' undeclared (first use this function)
xxx/FreetypeUtils.cpp:203: error: `FT_IS_SCALABLE' undeclared (first use this function)
xxx/FreetypeUtils.cpp:207: error: `FT_Set_Char_Size' undeclared (first use this function)
xxx/FreetypeUtils.cpp:215: error: `scale' undeclared (first use this function)
xxx/FreetypeUtils.cpp:216: error: `FT_MulFix' undeclared (first use this function)
xxx/FreetypeUtils.cpp: In function `int FT_GetCharBitmap(FT_Font*, const short unsigned int*, unsigned char*, int, int, int, int, int&)':
xxx/FreetypeUtils.cpp:276: error: 'struct tagTEXT' has no member named 'bitmap'
xxx/FreetypeUtils.cpp:281: error: `FT_Bitmap' undeclared (first use this function)
xxx/FreetypeUtils.cpp:281: error: `bitmap' undeclared (first use this function)
xxx/FreetypeUtils.cpp:281: error: 'struct tagTEXT' has no member named 'bitmap'
xxx/FreetypeUtils.cpp:313: error: `FT_GlyphSlot' undeclared (first use this function)
xxx/FreetypeUtils.cpp:313: error: expected `;' before "slot"
xxx/FreetypeUtils.cpp:314: error: `FT_UInt' undeclared (first use this function)
xxx/FreetypeUtils.cpp:314: error: expected `;' before "glyph_index"
xxx/FreetypeUtils.cpp:315: error: `FT_Error' undeclared (first use this function)
xxx/FreetypeUtils.cpp:315: error: expected `;' before "error"
xxx/FreetypeUtils.cpp:316: error: `bm' undeclared (first use this function)
xxx/FreetypeUtils.cpp:324: error: `glyph_index' undeclared (first use this function)
xxx/FreetypeUtils.cpp:324: error: 'struct _FT_Font' has no member named 'face'
xxx/FreetypeUtils.cpp:324: error: `FT_Get_Char_Index' undeclared (first use this function)
Process terminated with status 1 (0 minutes, 21 seconds)
50 errors, 0 warnings
---------------------------------------------------------------------------
解决方法:

从错误提示信息不难看出是编译器找不到相应的头文件,
我们在工程的搜索目录中添加freetype2的头文件所在目录即可:
如我的freetype2头文件所在目录为:
/opt/mv_pro_4.0.1/montavista/pro/devkit/arm/v5t_le/target/usr/include/freetype2

freetype/config/ftheader.h: No such file or directory_第1张图片














你可能感兴趣的:(Linux)