Alexander Wilkinson
Alexander Wilkinson

Reputation: 7

Why isn't freetype loading these functions?

I have freetype as a dll. All of the header files are auto-completing on visual studio and the following statements compile fine: FT_Library ft; FT_Face face;. However, it can't find FT_Init_Freetype or FT_New_Face (LNK2019 unresolved external symbol ...). Here's my full code:

#include <ft2build.h>
#include FT_FREETYPE_H
#include <freetype/freetype.h>
#include <freetype/ftcache.h>
#include <freetype/ftbitmap.h>
// Just getting desperate including headers here

void initFreetype() {
    FT_Library ft;

    FT_Face face;
    
    if (FT_Init_FreeType(&ft)) {
        fprintf(stderr, "Could not init freetype library\n");
        return;
    }
    if (FT_New_Face(ft, "C:\\Font\\verdana.ttf", 0, &face)) {
        fprintf(stderr, "Could not open font\n");
        return;
    }
}```

Upvotes: 0

Views: 260

Answers (1)

Alexander Wilkinson
Alexander Wilkinson

Reputation: 7

I was stupid and was pointing to freetype\objs instead of freetype\objs\Win32\Debug in the linker.

I'm still getting other errors (unresolved external symbol _sprintf... from freetype.lib(bdf.obj) though, so I think something else may be wrong too.

Edit: That last error was fixed here: https://community.cypress.com/thread/14289?start=0&tstart=0 by linking legacy_stdio_definitions.lib

Upvotes: 1

Related Questions