gcc 的 --sysroot 开关的替代品? [英] Alternatives to the --sysroot switch of gcc?

查看:25
本文介绍了gcc 的 --sysroot 开关的替代品?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当您不希望标准路径中的标头/库影响您的构建时,--sysroot 开关非常有用.

The --sysroot switch is useful when you don't want the headers/libraries in the standard paths affect your build.

--sysroot=dir:使用 dir 作为 headers 的逻辑根目录和图书馆.例如,如果编译器通常会搜索/usr/include 和库中的标头在/usr/lib 中,它将改为搜索目录/usr/include 和目录/usr/lib.[参考]

--sysroot=dir: Use dir as the logical root directory for headers and libraries. For example, if the compiler would normally search for headers in /usr/include and libraries in /usr/lib, it will instead search dir/usr/include and dir/usr/lib. [ref]

是否可以通过使用环境变量、gcc 规范 文件或任何其他不需要命令行开关的方法来完成相同的操作?

Can the same thing be accomplished through the use of environment variables, the gcc specs file, or any other methods that do not require command line switches?

推荐答案

如果可以使用环境变量,可以将 --sysroot 添加到 CFLAGS.

If you can use environment variables you can add --sysroot to CFLAGS.

这篇关于gcc 的 --sysroot 开关的替代品?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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