【问题标题】:How to solve linking pdfium on windows 10如何解决在 Windows 10 上链接 pdfium
【发布时间】:2020-09-03 17:53:45
【问题描述】:

我在 Windows 上的 C:\repo\pdfium\out\debug\obj\test 目录中有 main.cpp。 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 上没有链接。 任何建议都是有效的。

谢谢

吉姆

【问题讨论】:

  • 我一直在尝试在 MSYS2 下使用 MinGW-w64 构建 pdfium,它似乎使用 gn 作为构建工具。我的系统上有gn,但我似乎无法让它配置/构建项目。你如何构建 pdfium?
  • @BrechtSanders 如果您仍然对答案感兴趣,可能值得在自己的问题中提出这个问题。

标签: windows gcc linker pdfium


【解决方案1】:

如果您使用非组件构建(is_component_build = false in args.gn)构建 PDFium 并且未设置 pdf_is_complete_lib = true,则生成的 .lib 文件将不包含它们的依赖项,所以您很可能让链接器抱怨缺少符号。尝试生成 DLL (is_component_build = true) 或设置 pdf_is_complete_lib = true

如果您使用组件构建,则需要将 PDFium DLL 及其依赖项(至少是 zlib DLL,可能还有其他)与您的应用程序打包。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-12-06
    • 1970-01-01
    • 1970-01-01
    • 2015-12-04
    • 2021-02-15
    • 2018-06-04
    • 1970-01-01
    • 2020-03-05
    相关资源
    最近更新 更多