编译错误-缺少zlib.h [英] Compilation error - missing zlib.h

查看:593
本文介绍了编译错误-缺少zlib.h的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用IBM XL编译器在Blue Gene Q上编译软件,但出现此错误消息:

I am trying to compile software on Blue Gene Q using IBM XL compilers and I got this error message:

"iostreams/zlib.cpp", line 19.10: 1540-0836 (S) The #include file "zlib.h" is not found.
make[3]: *** [zlib.o] Error 1

我有安装了新版本的zlib并使用 $ HOME / zlib / include

I have installed a new version of zlib and updated LD_LIBRARY_PATH with $HOME/zlib/include

我缺少什么吗?

推荐答案

您已将库安装在非标准位置( $ HOME / zlib / )。这意味着编译器将不知道您的头文件在哪里,您需要告诉编译器。

You have installed the library in a non-standard location ($HOME/zlib/). That means the compiler will not know where your header files are and you need to tell the compiler that.

您可以在编译器用来搜索的列表中添加路径。通过使用 -I (大写i)选项来处理头文件。

You can add a path to the list that the compiler uses to search for header files by using the -I (upper-case i) option.

还请注意 LD_LIBRARY_PATH 用于运行时链接器和加载器,在尝试运行应用程序时会搜索动态库。要为构建时链接程序添加路径,请使用 -L 选项。

Also note that the LD_LIBRARY_PATH is for the run-time linker and loader, and is searched for dynamic libraries when attempting to run an application. To add a path for the build-time linker use the -L option.

所有命令行应该看起来像

All-together the command line should look like

$ c++ -I$HOME/zlib/include some_file.cpp -L$HOME/zlib/lib -lz

这篇关于编译错误-缺少zlib.h的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆