工具链问题:如何添加标头/库以便编译器知道在哪里找到它?

发布于 2024-09-29 15:30:29 字数 308 浏览 0 评论 0原文

我使用此脚本制作了一个工具链: http://gist.github.com/403608 (更多或进行较少的修改即可使其正常工作)

一切都已安装,现在当我尝试使用它进行编译时,当我 ./configure 时出现错误,它说我的 C 编译器无法创建可执行文件。我认为我的编译器只是不知道在哪里查找所有标头和库...因为它们不在 /usr/ 中,而是在 /var/sdk/usr/ 中

有没有办法告诉我的编译器也总是查看 /var/sdk/usr/ 吗?

I have made a toolchain using this script: http://gist.github.com/403608 (more or less modified to get it to work)

Everything is installed and now when I try to compile using it I get an error when I ./configure it says that my C compiler cannot create exeicutables. I'm thinking that my compiler just doesn't know where to look for all the headers and libs... cause they are not in /usr/ they are in /var/sdk/usr/

is there a way to tell my compiler to always look in /var/sdk/usr/ also?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

半岛未凉 2024-10-06 15:30:29

大多数配置脚本使用 LDFLAGSCPPFLAGS 环境变量来修改包含和库的目录搜索路径。

LDFLAGS="-L/other/libs" CPPFLAGS="-I/other/includes" ./configure

您还可以查看编译器文档,因为它们通常也会查看环境变量。例如,gcc 在 LIBRARY_PATH 列出的目录中查找库。它还会在目录 CPATH 中查找包含内容。

Most configure scripts use LDFLAGS and CPPFLAGS environment variables to modify directory search paths for includes and libs.

LDFLAGS="-L/other/libs" CPPFLAGS="-I/other/includes" ./configure

You can also look at the compiler documentation as they usually have environment variables they look at as well. For example gcc looks in directories listed LIBRARY_PATH for libs. It will also look directories CPATH for includes.

一萌ing 2024-10-06 15:30:29

进入您的目标设置(按住 Control 键单击目标并选择“信息”)。选择“构建”选项卡,然后为标头填写“标头搜索路径”,为库填写“库搜索路径”。

Go into your target settings (control-click on a target and choose Info). Select the Build tab, then fill in Header Search Paths for headers, Library Search Paths for libraries.

蔚蓝源自深海 2024-10-06 15:30:29

对于 gcc,请使用 目录搜索选项

    gcc -L/foo/bar/baz
    gcc -I/foo/bar/quux

第一个添加目录 / foo/bar/baz 到链接器搜索路径(将在此处找到库)。第二个将目录 /foo/bar/quux 添加到目录列表的前面以搜索标头。一次调用中可以出现混合和多个 -I 和 -L 选项。如果使用多个“-I”,则按从左到右的顺序搜索它们,然后搜索系统目录。

For gcc, use the directory search options

    gcc -L/foo/bar/baz
    gcc -I/foo/bar/quux

The first one adds the directory /foo/bar/baz to the linker search path (libs will be found here). The second one adds the directory /foo/bar/quux to the front on the list of directories to search for headers. Mixed and multiple -I and -L options can occur in a single invocation. If you use multiple "-I"s, they are searched in left to right order and then the system directories are searched.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文