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)构建的
有了命令,我正在生产主机。
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上链接。任何建议都将是救赎的。
谢谢
吉姆
发布于 2021-02-05 22:13:43
如果您使用非组件构建( PDFium中的is_component_build = false in args.gn)而不设置pdf_is_complete_lib = true,则生成的.lib文件将不包含它们的依赖项,因此很可能会让链接器抱怨缺少符号。尝试生成DLL (is_component_build = true)或设置pdf_is_complete_lib = true。
如果使用组件构建,则需要将PDFium DLL及其依赖项(至少是zlib DLL,可能还有其他依赖项)打包到应用程序中。
https://stackoverflow.com/questions/63729197
复制相似问题