Sign in to follow this  

FTGL unresolved external symbols

This topic is 3209 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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?

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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" { ... } ?

Share this post


Link to post
Share on other sites
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++?

Share this post


Link to post
Share on other sites
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]

Share this post


Link to post
Share on other sites
I found the problem, you were right, I had to use extern "C", thx.

What I had done was, I've downloaded other versions of FreeType, and obviously the older version's lib folder had higher precedence that the new one, so FTGL compiled with the wrong headers. :/

I hope it's working now, the demo compiled, but won't start, but I'll probably figure it out.

Edit: Couldn't open default file 'C:\WINNT\Fonts\arial.ttf'
-_-

Edit: Can anyone confirm that this is the way it is supposed to look?
http://img.photobucket.com/albums/v363/Grantax/demo2.jpg

[Edited by - Grantax on September 19, 2007 1:16:21 PM]

Share this post


Link to post
Share on other sites
Hi,

I have basically the same errors when I try to build ftgl 2.1.3. I tried putting the extern "C" around the includes for freetype headers in ftgl.h like so:

/* We need the Freetype headers */
#ifdef __cplusplus
extern "C"
{
#include <ft2build.h>
#include FT_FREETYPE_H
#include FT_GLYPH_H
#include FT_OUTLINE_H
}
#else
#include <ft2build.h>
#include FT_FREETYPE_H
#include FT_GLYPH_H
#include FT_OUTLINE_H
#endif

But no luck.

Can some one describe exactly where I need to put the extern "C" please. I realise this is an old post but I am getting desperate.

I have built freetype 2.3.5 in Visual Studio 2008 (vc9) and am building ftgl in the same environment. The freetype build had lots of warnings but built successfully in both debug and release giving me freetype235MT_D.lib and freetype235MT.lib and these are the ones i link against in ftgl.

Any help greatly appreciated.

Cheers,

Lee

Share this post


Link to post
Share on other sites
Hello, even though there has been no replies I thought I would post how i got around this problem for anyone trawling for answers as I have been.

The problem seems to have been with my freetype libs that I built from the freetype source. After getting fed up I thought why not try the prebult lib for freetype (downloaded from the FreeType downloads page) and hey presto I was then able to build my ftgl_dll project.

I have no idea why my freetyoe build was broken. I did have lots of warnings. At this point I have to move on to other things and cannot spend time on it so if anyone has any ideas I would be interested to know.

Cheers,

Lee

Share this post


Link to post
Share on other sites

This topic is 3209 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this