免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 3829 | 回复: 3
打印 上一主题 下一主题

[C++] mingw cmake找不到头文件路径 [复制链接]

论坛徽章:
2
2015亚冠之莱赫维亚
日期:2015-09-14 11:19:42操作系统版块每日发帖之星
日期:2015-11-05 06:20:00
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2015-11-20 10:42 |只看该作者 |倒序浏览
本帖最后由 lixinwei1985@si 于 2015-11-25 11:11 编辑

win7 mingw mysy2  环境

CMakeLists.txt :
      INCLUDE_DIRECTORIES(/usr/include/libxml2)  添加头文件目录


cmake -G "MinGW Makefiles" ..
make 后报错提示 找不到头文件:
      C:\work\workspace\api_dev\testcmake\hello.cpp:2:25: fatal error: libxml/list.h: No such file or directory

make VERBOSE=1 看了详细:
C:\PROGRA~1\MINGW-~1\X86_64~1.1-P\mingw64\bin\G__~1.EXE    @CMakeFiles/hello.dir/includes_CXX.rsp   -o CMakeFiles\hello.dir\hello.cpp.obj -c C:\work\workspace\api_dev\testcmake\hello.cpp

cat CMakeFiles/hello.dir/includes_CXX.rsp
-I/usr/include/libxml2


@CMakeFiles/hello.dir/includes_CXX.rsp 这个前面的@什么意思,应该是这个没人读到路径文件吧 ,谁碰到类似问题,求指教

论坛徽章:
24
狮子座
日期:2013-12-31 10:48:0015-16赛季CBA联赛之吉林
日期:2016-04-18 14:43:1015-16赛季CBA联赛之北控
日期:2016-05-18 15:01:4415-16赛季CBA联赛之上海
日期:2016-06-22 18:00:1315-16赛季CBA联赛之八一
日期:2016-06-25 11:02:2215-16赛季CBA联赛之佛山
日期:2016-08-17 22:48:2615-16赛季CBA联赛之福建
日期:2016-12-27 22:39:272016科比退役纪念章
日期:2017-02-08 23:49:4315-16赛季CBA联赛之八一
日期:2017-02-16 01:05:3415-16赛季CBA联赛之山东
日期:2017-02-22 15:34:5615-16赛季CBA联赛之上海
日期:2017-11-25 16:17:5015-16赛季CBA联赛之四川
日期:2016-01-17 18:38:37
2 [报告]
发表于 2015-11-20 11:57 |只看该作者
回复 1# lixinwei1985@si


      我认为,像 "/usr/include/libxml2" 这类 unix 风格的路径 win 下需要在类似 msys,msys2 之类的环境里才能找到。

论坛徽章:
2
2015亚冠之莱赫维亚
日期:2015-09-14 11:19:42操作系统版块每日发帖之星
日期:2015-11-05 06:20:00
3 [报告]
发表于 2015-11-25 11:10 |只看该作者
回复 2# zhujiang73


     是在mysy 环境

论坛徽章:
24
狮子座
日期:2013-12-31 10:48:0015-16赛季CBA联赛之吉林
日期:2016-04-18 14:43:1015-16赛季CBA联赛之北控
日期:2016-05-18 15:01:4415-16赛季CBA联赛之上海
日期:2016-06-22 18:00:1315-16赛季CBA联赛之八一
日期:2016-06-25 11:02:2215-16赛季CBA联赛之佛山
日期:2016-08-17 22:48:2615-16赛季CBA联赛之福建
日期:2016-12-27 22:39:272016科比退役纪念章
日期:2017-02-08 23:49:4315-16赛季CBA联赛之八一
日期:2017-02-16 01:05:3415-16赛季CBA联赛之山东
日期:2017-02-22 15:34:5615-16赛季CBA联赛之上海
日期:2017-11-25 16:17:5015-16赛季CBA联赛之四川
日期:2016-01-17 18:38:37
4 [报告]
发表于 2015-11-25 15:13 |只看该作者
lixinwei1985@si 发表于 2015-11-25 11:10
回复 2# zhujiang73



       那还得看安装的是那个包的 libxml2, msys2 环境下一个软件可能有三种不同的包,mingw32,mingw64, msys2, 三种包的路径不一样,有的 cmake 脚本认不出来。


       比如我这个是在:  /mingw32/include/libxml2/libxml/list.h

$ pacman  -Qi  mingw-w64-i686-libxml2
Name            : mingw-w64-i686-libxml2
Version         : 2.9.2-6
Description     : XML parsing library, version 2 (mingw-w64)
Architecture    : any
URL             : http://www.xmlsoft.org/
Licenses        : MIT
Groups          : mingw-w64-i686
Provides        : 无
Depends On      : mingw-w64-i686-gcc-libs  mingw-w64-i686-gettext  mingw-w64-i686-xz  mingw-w64-i686-zlib
Optional Deps   : 无
Required By     : 无
Optional For    : 无
Conflicts With  : 无
Replaces        : 无
Installed Size  :  11.68 MiB
Packager        : Alexey Pavlov <alexpux@gmail.com>
Build Date      : 2015年06月30日 18:15:33
Install Date    : 2015年11月25日 15:03:54
Install Reason  : 单独指定安装
Install Script  : 是
Validated By    : 数字签名

$ pacman  -Ql  mingw-w64-i686-libxml2
mingw-w64-i686-libxml2 /mingw32/
mingw-w64-i686-libxml2 /mingw32/bin/
mingw-w64-i686-libxml2 /mingw32/bin/libxml2-2.dll
mingw-w64-i686-libxml2 /mingw32/bin/xml2-config
mingw-w64-i686-libxml2 /mingw32/bin/xmlcatalog.exe
mingw-w64-i686-libxml2 /mingw32/bin/xmllint.exe
mingw-w64-i686-libxml2 /mingw32/include/
mingw-w64-i686-libxml2 /mingw32/include/libxml2/
mingw-w64-i686-libxml2 /mingw32/include/libxml2/libxml/
mingw-w64-i686-libxml2 /mingw32/include/libxml2/libxml/DOCBparser.h
mingw-w64-i686-libxml2 /mingw32/include/libxml2/libxml/HTMLparser.h
mingw-w64-i686-libxml2 /mingw32/include/libxml2/libxml/HTMLtree.h
mingw-w64-i686-libxml2 /mingw32/include/libxml2/libxml/SAX.h
mingw-w64-i686-libxml2 /mingw32/include/libxml2/libxml/SAX2.h
mingw-w64-i686-libxml2 /mingw32/include/libxml2/libxml/c14n.h
mingw-w64-i686-libxml2 /mingw32/include/libxml2/libxml/catalog.h
mingw-w64-i686-libxml2 /mingw32/include/libxml2/libxml/chvalid.h
mingw-w64-i686-libxml2 /mingw32/include/libxml2/libxml/debugXML.h
mingw-w64-i686-libxml2 /mingw32/include/libxml2/libxml/dict.h
mingw-w64-i686-libxml2 /mingw32/include/libxml2/libxml/encoding.h
mingw-w64-i686-libxml2 /mingw32/include/libxml2/libxml/entities.h
mingw-w64-i686-libxml2 /mingw32/include/libxml2/libxml/globals.h
mingw-w64-i686-libxml2 /mingw32/include/libxml2/libxml/hash.h
mingw-w64-i686-libxml2 /mingw32/include/libxml2/libxml/list.h
mingw-w64-i686-libxml2 /mingw32/include/libxml2/libxml/nanoftp.h
mingw-w64-i686-libxml2 /mingw32/include/libxml2/libxml/nanohttp.h
mingw-w64-i686-libxml2 /mingw32/include/libxml2/libxml/parser.h
mingw-w64-i686-libxml2 /mingw32/include/libxml2/libxml/parserInternals.h
mingw-w64-i686-libxml2 /mingw32/include/libxml2/libxml/pattern.h

您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP