views:

272

answers:

1

Well, here's a nice obscure one. I'm trying to compile the latest open transport tycoon source in Visual Studio 2005. (It's a C++ app that uses zlib, dx8 and a few other fairly common libraries).

I get a few linker errors to do with the freetype dependencies:

Error   1 error LNK2001: unresolved external symbol @FT_Done_Face@4 fontcache.obj 
Error   2 error LNK2001: unresolved external symbol @FT_Load_Char@12 fontcache.obj 
Error   3 error LNK2001: unresolved external symbol @FT_Init_FreeType@4 fontcache.obj 
Error   4 error LNK2001: unresolved external symbol @FT_Select_Charmap@8 fontcache.obj 
Error   5 error LNK2001: unresolved external symbol @FT_Set_Charmap@8 fontcache.obj 
Error   6 error LNK2001: unresolved external symbol @FT_New_Face@16 fontcache.obj 
Error   7 error LNK2001: unresolved external symbol @FT_Render_Glyph@8 fontcache.obj 
Error   8 error LNK2001: unresolved external symbol @FT_Set_Pixel_Sizes@12 fontcache.obj 
Error   9 fatal error LNK1120: 8 unresolved externals ..\objs\Win32\Release\\openttd.exe

I've downloaded the most recent freetype stable and compiled it (also in VS2005), and put the ft2build.h and freetype include directories into my VS8/VC/include directory, and put the libfreetype2.lib library so compiled into my VS8/VC/lib directory. What could I be missing?

Thanks!

+1  A: 

The @ sign at the start of the mangled function names show that your fontcache.obj file is expecting these functions to have the __fastcall calling convention, which is unusual as the default calling convention is __cdecl. I suspect there's a mismatch somewhere in the compiler settings used to build the libraries and those used to build the application. See here and here for more information.

ChrisN
Thanks - turns out that the openttd project *was* set to build using fastcall. I first tried switching freetype to fastcall, but it threw a couple of compiler errors - so I switched the openttd project over to cdecl instead and that worked fine.