无此类文件或目录

无此类文件或目录

本文介绍了无法通过cmake在Windows上编译libpng 1.6:无法打开包含文件:'zlib.h':无此类文件或目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

VS 2015 Update1。
预构建的zlib被提取到project / zlib中。 find_package使用提供的适当的var可以很好地找到它。
它添加了包含在cl调用中的目录:

C:\Program Files(x86)\Microsoft Visual Studio 14.0\VC\bin\ 86x86_amd64\CL.exe / c / IC:\project\zlib\include / IC:\project\libpng / nologo / W3 / WX- / O2 / Ob2 / D WIN32 / D _WINDOWS / D NDEBUG / D _CRT_SECURE_NO_DEPRECATE / D CMAKE_INTDIR = \发布\ / D _MBCS / Gm- / MD / GS / fp:precise / Zc:wchar_t / Zc:forScope / Zc:inline /Fo\"png16_static.dir\ Release\\ /Fd\"png16_static.dir\发布\png16_static.pdb / Gd / TC / errorReport:队列C:\project\libpng\png.c C:\project\libpng errorpngerror.c C:\project\libpng\pngget.c C:\project\libpng\pngmem.c C:\project\libpng\pngpread.c C:\project\ \libpng\pngread.c C:\project\libpng\pngrio.c C:\project\libpng\pngrtran.c C:\project\libpng\pngrutil.c C:\ C:\project\libpng\pngset.c C:\project\libpng\pngtrans.c C:\project\libpng\pngwio.c C:\project\libpng\pngwrite.c C: Cproject\libpng\pngwtran.c C:\project\libpng\pngwutil.c

VS 2015 Update 1.Prebuilt zlib is extracted into project/zlib. find_package finds it alright with proper vars supplied.It adds the dir as include in cl invocation: C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\x86_amd64\CL.exe /c /IC:\project\zlib\include /IC:\project\libpng /nologo /W3 /WX- /O2 /Ob2 /D WIN32 /D _WINDOWS /D NDEBUG /D _CRT_SECURE_NO_DEPRECATE /D "CMAKE_INTDIR=\"Release\"" /D _MBCS /Gm- /MD /GS /fp:precise /Zc:wchar_t /Zc:forScope /Zc:inline /Fo"png16_static.dir\Release\\" /Fd"png16_static.dir\Release\png16_static.pdb" /Gd /TC /errorReport:queue C:\project\libpng\png.c C:\project\libpng\pngerror.c C:\project\libpng\pngget.c C:\project\libpng\pngmem.c C:\project\libpng\pngpread.c C:\project\libpng\pngread.c C:\project\libpng\pngrio.c C:\project\libpng\pngrtran.c C:\project\libpng\pngrutil.c C:\project\libpng\pngset.c C:\project\libpng\pngtrans.c C:\project\libpng\pngwio.c C:\project\libpng\pngwrite.c C:\project\libpng\pngwtran.c C:\project\libpng\pngwutil.c

但它在编译过程中失败:

but it fails during compilation with:

c:\project\libpng\pngstruct.h(30):致命错误C1083:无法打开包含文件:'zlib.h':没有这样的文件或目录等。

看不到有什么问题。肯定在 C:\project\zlib\include

Can't see what's could be wrong. There is definitely zlib.h inside C:\project\zlib\include

推荐答案

我不敢相信原因是多么愚蠢。问题是在CI上,zlib的内容被提取到一个额外的zlib文件夹中(所以它是zlib / zlib),因为存档已经包含zlib文件夹。

I can't believe how stupid the reason was. The problem was that on CI zlib contents got extracted into one extra zlib folder (so it was zlib/zlib) since archive already contained zlib folder.

这篇关于无法通过cmake在Windows上编译libpng 1.6:无法打开包含文件:'zlib.h':无此类文件或目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-03 19:22