windows - 使用库 pdfium 构建小型 c 程序时出错
问题描述
我正在尝试使用 pdfium 构建 init.c,以测试是否有效。我在桌面上的 dir、文件 init.c、pdfium.lib 和带有 pdfium 头文件的公共目录。init.c 代码是
#include <fpdfview.h>
int main() {
FPDF_LIBRARY_CONFIG config;
config.version = 2;
config.m_pUserFontPaths = NULL;
config.m_pIsolate = NULL;
config.m_v8EmbedderSlot = 0;
FPDF_InitLibraryWithConfig(&config);
FPDF_DestroyLibrary();
return 0;
}
在 Windows cmd 类型上打开...
set PDF_LIBS="-lpdfium -lfpdfapi -lfxge -lfpdfdoc -lfxcrt -lfx_agg -lfxcodec -lfx_lpng -lfx_libopenjpeg -lfx_lcms2 -lfx_freetype -ljpeg -lfdrm -lpwl -lbigint -lformfiller -ljavascript -lfxedit"
set PDF_DIR=pdfium
然后尝试构建...
g++ -I $PDF_DIR/public -o init init.c -L $PDF_DIR/out/Debug -lstdc++ $PDF_LIBS
我正在犯错误...
>g++ -I $PDF_DIR/public -o init init.c -L $PDF_DIR/out/Debug -lstdc++ $PDF_LIBS
g++:错误:$PDF_LIBS:没有这样的文件或目录
知道为什么吗?我已接受https://pdfium.googlesource.com/pdfium/+/master/docs/getting-started.md的指示 谢谢吉姆
解决方案
您试图在 Windows 的 shell 中使用 bash(和其他 Linux shell)变量扩展语法,这是行不通的。Windows 使用%VAR%
而不是$VAR
.
所以,要么使用正确的语法,就像这样......
g++ -I %PDF_DIR%/public -o init init.c -L %PDF_DIR%/out/Debug -lstdc++ %PDF_LIBS%
...或使用 Linux shell。作为开发人员,您可能已经安装了 Git,因此您可以使用 Git bash。
推荐阅读
- python - 为什么 datetime 为同一时区提供不同的时区格式?
- python - 可以自动将新数据从服务器下载到我的本地备份的脚本
- android - 如何更新应用程序使用的外部文件?
- python-3.x - 如何更改 exec() 函数中变量的值?
- vba - excel vba中带有自动完成/建议的下拉列表
- microsoft-graph-api - OneDrive 中的节流
- c# - 使用 SqlDatRecord 结果列表插入行 数据库中的外键错误
- gcc - 未定义对 `__isoc99_sscanf@GLIBC_2.7' 的引用
- java - 如何将主题的所有记录存储在单个文件中。?
- ssl - OCSP 查询没有颁发者证书的中间证书