我正在尝试使用MinGW-w64(x86_64)编译libpng。我使用MinGW Makefiles
生成器使用CMake设置了libpng。运行make时,我得到以下输出:
Scanning dependencies of target png16
[ 2%] Building C object CMakeFiles/png16.dir/png.obj
In file included from C:/PROGRA~2/MICROS~3.0/VC/include/vcruntime.h:46:0,
from C:/PROGRA~2/MICROS~3.0/VC/include/crtdefs.h:9,
from C:/PROGRA~1/MINGW-~1/X86_64~1.2-P/mingw64/x86_64-w64-mingw32/include/stdlib.h:9,
from C:\CPP\deps\lpng1617\pngpriv.h:42,
from C:\CPP\deps\lpng1617\png.c:14:
C:/PROGRA~2/MICROS~3.0/VC/include/vadefs.h:28:35: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'uintptr_t'
typedef unsigned __int64 uintptr_t;
^
In file included from C:/PROGRA~2/MICROS~3.0/VC/include/crtdefs.h:9:0,
from C:/PROGRA~1/MINGW-~1/X86_64~1.2-P/mingw64/x86_64-w64-mingw32/include/stdlib.h:9,
from C:\CPP\deps\lpng1617\pngpriv.h:42,
from C:\CPP\deps\lpng1617\png.c:14:
C:/PROGRA~2/MICROS~3.0/VC/include/vcruntime.h:81:1: error: unknown type name 'pack'
_CRT_BEGIN_C_HEADER
^
... and more ...
为什么MinGW尝试从Visual Studio中包含头文件?第9行的stdlib.h
包括crtdefs.h
,它包含在Visual Studio中,而不是MinGW目录中。为什么呢?
crtdefs.h
确实存在于MinGW目录中(stdlib.h
旁边)
我的%PATH%
变量不包含任何Visual Studio(也不是Windows SDK)文件夹。
经过更多调查后,我发现build\CMakeFiles\png16_static.dir\includes_C.rsp
包含-IC:/PROGRA~2/MICROS~3.0/VC/include
答案 0 :(得分:0)
在几次系统重启后,重新安装MinGW和CMake,并将环境变量设置为默认值,它现在似乎正在运行。不确定到底出了什么问题。