当您不希望标准路径中的 header /库影响您的构建时,--sysroot
开关非常有用。
--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 specs 文件或任何其他不需要命令行开关的方法来完成同样的事情吗?
最佳答案
如果可以使用环境变量,则可以将 --sysroot 添加到 CFLAGS。
关于gcc - gcc 的 --sysroot 开关的替代品?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15209062/