问题描述
我在Windows上的main.cpp位于C:\ repo \ pdfium \ out \ debug \ obj \ test目录。 Pdfium.lib位于obj目录。
#include <stdio.h>
#include <fpdfview.h>
int main() {
FPDF_InitLibrary();
FPDF_DestroyLibrary();
printf("PDFium hello.\n");
return 0;}
pdfium.lib是使用GCC(is_lang = false)构建的
使用命令我正在生成main.o
g ++。exe -std = c ++ 11 -g -I ........ \ public -c C:\ repo \ pdfium \ out \ debug \ obj \ test \ main.cpp -o obj \ Debug \ main.o
使用波纹管命令我试图链接pdfium.lib
g++.exe -o bin\Debug\test.exe obj\Debug\main.o ..\pdfium.lib
但是我正在服用...
Warning: corrupt .drectve at end of def file
..\pdfium.lib(obj/core/fpdfapi/parser/parser/fpdf_parser_utility.obj):(.xdata[$unwind$?_Makestr@_System_error@std@@CA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@Verror_code@2@V32@@Z]+0x8): undefined reference to `__GSHandlerCheck'
我已经尝试了很多次,但是在Windows 10上的链接却一无所获。 任何建议都可以兑换。
谢谢
吉姆
解决方法
如果您使用非组件构建(is_component_build = false
中的args.gn
)构建 PDFium 并且未设置 pdf_is_complete_lib = true
,则生成的 .lib
文件将没有它们的包括依赖项,因此您很可能让链接器抱怨缺少符号。尝试生成 DLL (is_component_build = true
) 或设置 pdf_is_complete_lib = true
。
如果您使用组件构建,则需要将 PDFium DLL 及其依赖项(至少 zlib
DLL,可能还有其他)与您的应用程序一起打包。