我正在尝试使用Windows Build工具在https://github.com/zserge/webview上编译库。
mingw
的命令行是
cc main.c -DWEBVIEW_WINAPI=1 -lole32 -lcomctl32 -loleaut32 -luuid -mwindows -o webview-example.exe
我正在使用/D WEBVIEW_WINAPI=1
,并且.h文件已成功编译。但它无法与unresolved externals
链接。我不确定-lole32
等用什么。
我尝试了/L
,但它给出了错误。知道什么是等效的吗?
编辑:
我添加了/link ole32.lib comctl32.lib oleaut32.lib uuid.lib
作为链接器标志,但仍然在链接中给出错误:
C:\Users\Arun\webview>cl main.c /D WEBVIEW_WINAPI=1 /link ole32.lib comctl32.lib oleaut32.lib uuid.lib
Microsoft (R) C/C++ Optimizing Compiler Version 19.16.27027.1 for x64
Copyright (C) Microsoft Corporation. All rights reserved.
main.c
c:\users\arun\webview\webview.h(1155): warning C4477: 'sscanf' : format string '%02x' requires an argument of type 'unsigned int *', but variadic argument 1 has type 'char *'
c:\users\arun\webview\webview.h(1155): note: consider using '%hhx' in the format string
Microsoft (R) Incremental Linker Version 14.16.27027.1
Copyright (C) Microsoft Corporation. All rights reserved.
/out:main.exe
ole32.lib
comctl32.lib
oleaut32.lib
uuid.lib
main.obj
main.obj : error LNK2019: unresolved external symbol __imp_CreateSolidBrush referenced in function webview_set_color
main.obj : error LNK2019: unresolved external symbol __imp_RegCloseKey referenced in function webview_fix_ie_compat_mode
main.obj : error LNK2019: unresolved external symbol __imp_RegCreateKeyA referenced in function webview_fix_ie_compat_mode
main.obj : error LNK2019: unresolved external symbol __imp_RegSetValueExA referenced in function webview_fix_ie_compat_mode
main.exe : fatal error LNK1120: 4 unresolved externals
答案 0 :(得分:0)
我使用以下命令使其工作:
cl main.c /D WEBVIEW_WINAPI=1 /link ole32.lib comctl32.lib oleaut32.lib uuid.lib gdi32.lib advapi32.lib
缺少的功能驻留在gdi32.lib和advapi32.lib中。
谢谢