Building PDFium with Microsoft Visual C++ 2010 Express

For the issue, fatal error RC1015: cannot open include file ‘afxres.h’
not just change “afxres.h” to <windows.h>, but use a better one,

#ifdef _MFC_VER
#include "afxres.h"
#include <windows.h>

For the issue,core\src\fxge\fx_freetype\fxft2.5.01\src\type1\t1gload.c(287): error C2275: ‘FT_Data’ : illegal use of this type as an expression,
the reason is,

Your code cannot be compiled as C++ code. You’ll have to follow ‘C’ rules, a local variable declaration must appear before any statements in a function body.

so the solution we need put the declarations,

FT_Data glyph_data;
FT_Bool must_finish_decoder = FALSE;
FT_Bool glyph_data_loaded = 0;

before the statements,

font_offset.x = 0;
font_offset.y = 0;

Refer to PDFium Wiki Building PDFium,  I got all.sln, then open and compile it with Microsoft Visual C++ 2010 Express, got this error,

1>fpdfsdk\src\fpdfsdkdll.rc(10): fatal error RC1015: cannot open include file ‘afxres.h’.

After some research, got the answer,

This header is a part of the MFC Library. VS Express edition doesn’t contain MFC. If your project doesn’t use MFC you can safely replace afxres.h with windows.h in your fpdfsdkdll.rc.

after the change, successfully compile it.

pdfium001 references,



Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.