FTGL unresolved external symbols

Started by
12 comments, last by Lee_Wilson 15 years, 1 month ago
Like everyone else, I'm trying to get FTGL working. I've compiled all (I think) of the libraries I need, but I'm getting unresolved external symbols when I'm trying to compile the demos that come with FTGL.
Quote:------ Rebuild All started: Project: ftgl_demo, Configuration: Debug Win32 ------ Deleting intermediate and output files for project 'ftgl_demo', configuration 'Debug|Win32' Compiling... demo.cpp d:\linked files\ftgl\win32_vcpp\ftgl_demo\demo.cpp(479) : warning C4996: 'fopen' was declared deprecated d:\programs\microsoft visual studio\vc\include\stdio.h(234) : see declaration of 'fopen' Message: 'This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_DEPRECATE. See online help for details.' Compiling manifest to resources... Linking... ftgl_static_MT_d.lib(FTPixmapGlyph.obj) : error LNK2019: unresolved external symbol __imp__FT_Render_Glyph referenced in function "public: __thiscall FTPixmapGlyph::FTPixmapGlyph(struct FT_GlyphSlotRec_ *)" (??0FTPixmapGlyph@@QAE@PAUFT_GlyphSlotRec_@@@Z) ftgl_static_MT_d.lib(FTBitmapGlyph.obj) : error LNK2001: unresolved external symbol __imp__FT_Render_Glyph ftgl_static_MT_d.lib(FTTextureGlyph.obj) : error LNK2001: unresolved external symbol __imp__FT_Render_Glyph ftgl_static_MT_d.lib(FTFace.obj) : error LNK2019: unresolved external symbol __imp__FT_New_Face referenced in function "public: __thiscall FTFace::FTFace(char const *)" (??0FTFace@@QAE@PBD@Z) ftgl_static_MT_d.lib(FTFace.obj) : error LNK2019: unresolved external symbol __imp__FT_New_Memory_Face referenced in function "public: __thiscall FTFace::FTFace(unsigned char const *,unsigned int)" (??0FTFace@@QAE@PBEI@Z) ftgl_static_MT_d.lib(FTFace.obj) : error LNK2019: unresolved external symbol __imp__FT_Done_Face referenced in function "public: virtual __thiscall FTFace::~FTFace(void)" (??1FTFace@@UAE@XZ) ftgl_static_MT_d.lib(FTFace.obj) : error LNK2019: unresolved external symbol __imp__FT_Attach_File referenced in function "public: bool __thiscall FTFace::Attach(char const *)" (?Attach@FTFace@@QAE_NPBD@Z) ftgl_static_MT_d.lib(FTFace.obj) : error LNK2019: unresolved external symbol __imp__FT_Attach_Stream referenced in function "public: bool __thiscall FTFace::Attach(unsigned char const *,unsigned int)" (?Attach@FTFace@@QAE_NPBEI@Z) ftgl_static_MT_d.lib(FTFace.obj) : error LNK2019: unresolved external symbol __imp__FT_Get_Kerning referenced in function "public: class FTPoint __thiscall FTFace::KernAdvance(unsigned int,unsigned int)" (?KernAdvance@FTFace@@QAE?AVFTPoint@@II@Z) ftgl_static_MT_d.lib(FTFace.obj) : error LNK2019: unresolved external symbol __imp__FT_Load_Glyph referenced in function "public: struct FT_GlyphSlotRec_ * __thiscall FTFace::Glyph(unsigned int,int)" (?Glyph@FTFace@@QAEPAUFT_GlyphSlotRec_@@IH@Z) ftgl_static_MT_d.lib(FTSize.obj) : error LNK2019: unresolved external symbol __imp__FT_Set_Char_Size referenced in function "public: bool __thiscall FTSize::CharSize(struct FT_FaceRec_ * *,unsigned int,unsigned int,unsigned int)" (?CharSize@FTSize@@QAE_NPAPAUFT_FaceRec_@@III@Z) ftgl_static_MT_d.lib(FTGlyph.obj) : error LNK2019: unresolved external symbol __imp__FT_Outline_Get_CBox referenced in function "public: __thiscall FTBBox::FTBBox(struct FT_GlyphSlotRec_ *)" (??0FTBBox@@QAE@PAUFT_GlyphSlotRec_@@@Z) ftgl_static_MT_d.lib(FTLibrary.obj) : error LNK2019: unresolved external symbol __imp__FT_Done_FreeType referenced in function "public: __thiscall FTLibrary::~FTLibrary(void)" (??1FTLibrary@@QAE@XZ) ftgl_static_MT_d.lib(FTLibrary.obj) : error LNK2019: unresolved external symbol __imp__FT_Init_FreeType referenced in function "private: bool __thiscall FTLibrary::Initialise(void)" (?Initialise@FTLibrary@@AAE_NXZ) ftgl_static_MT_d.lib(FTCharmap.obj) : error LNK2019: unresolved external symbol __imp__FT_Set_Charmap referenced in function "public: __thiscall FTCharmap::FTCharmap(class FTFace *)" (??0FTCharmap@@QAE@PAVFTFace@@@Z) ftgl_static_MT_d.lib(FTCharmap.obj) : error LNK2019: unresolved external symbol __imp__FT_Select_Charmap referenced in function "public: bool __thiscall FTCharmap::CharMap(enum FT_Encoding_)" (?CharMap@FTCharmap@@QAE_NW4FT_Encoding_@@@Z) ftgl_static_MT_d.lib(FTCharmap.obj) : error LNK2019: unresolved external symbol __imp__FT_Get_Char_Index referenced in function "public: unsigned int __thiscall FTCharmap::FontIndex(unsigned int)" (?FontIndex@FTCharmap@@QAEII@Z) ../Build/ftgl_demo_static_d.exe : fatal error LNK1120: 15 unresolved externals Build log was saved at "file://d:\Linked Files\FTGL\win32_vcpp\ftgl_demo\Debug\BuildLog.htm" ftgl_demo - 18 error(s), 1 warning(s) ========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========
I'm linking freetype235MT_D.lib, which has the mentioned symbols. What's wrong? The space in the path doesn't cause it?
Advertisement
Just a quick question, have you ruled out name-mangling? (with an extern "C" {} )?
Try swapping the order in which freetype and FTGL are linked. I don't use MSVC so that's just a guess, but I've had similar problems which were fixed by changing linking order.
Quote:Original post by Jason Petrasko
Just a quick question, have you ruled out name-mangling? (with an extern "C" {} )?

Care to elaborate? :)

Quote:Original post by DeathCarrot
Try swapping the order in which freetype and FTGL are linked. I don't use MSVC so that's just a guess, but I've had similar problems which were fixed by changing linking order.

Didn't work.
So when a compiler (all the ones I've used anyway) compiles C and C++ code, it uses different name schemings for the exported symbols. There is a nice wikipedia article about it here: http://en.wikipedia.org/wiki/Name_mangling


I'm not sure if this is your problem, but if FreeType 2 was compiled as C, you will need to wrap all your FTGL headers calling it like so:

extern "C" {
// header includes here
}

From the mangled symbol names you are showing in your debug text here, I bet you are in C++. So this is worth a shot.
I compiled freetype2 with visual c++ 2005 myself, then what you said can not be the case, right?

Edit: But there are .c files ..
So I should open all the header files for FTGL and surround these lines:

#include <ft2build.h>
#include FT_FREETYPE_H
#include FT_GLYPH_H

with

extern "C" { ... } ?
You could also (might work) change the settings of your freetype project to force c++. If the library will compile in that mode. But, yes. Try that.
I had to leave after that post, but I understood that I had to put the extern "C" stuff inside the ft2build.h instead of all the FTGL headers, and it worked. :D (So far.. :D )

Thanks a lot, though I feel there are more problems coming my way.

8)

Edit: I compiled the wrong project, the problem didn't go away. :D

Edit: How do I force it to build in c++?
This entirely depends on your compiler. In GCC, which is my compiler of choice, I just call g++ instead of gcc inside the Makefile.
I found it, but I'll have to change a lot of the code in order to make it follow c++ rules. :/

Edit: Still same error, does the __imp_ mean anything?
FTPolyGlyph.obj : error LNK2001: unresolved external symbol __imp__FT_Outline_Get_CBox

[Edited by - Grantax on September 19, 2007 8:41:12 AM]

This topic is closed to new replies.

Advertisement