SysGCC 工具链无法在 sysroot 中找到文件
SysGCC toolchain can't find files in sysroot
我设置 this toolchain on my Windows machine for my Pi (raspberry-gcc4.6.3-nosysroot.exe) and then I followed the instructions here 来同步我的 sysroot。
我在我的项目中使用了一个名为 WiringPi 的库,我已经确认它在同步的 sysroot 中:
然后我尝试编译它:
arm-linux-gnueabihf-gcc -Wall -O -c main.c
但我收到以下错误:
fatal error: wiringPi.h: No such file or directory
我需要做什么才能让编译器找到头文件?我认为同步 sysroot 的全部意义在于使这种事情起作用?
您必须通过 -I
argument. In the case above, -IC:\SysGCC\Raspberry\...\usr\local
. You may have to add more than one include path, depending on where the required files are scattered. You can also try to set gcc's environment variable(s).
让 gcc 知道在哪里寻找包含文件
找出正确的包含路径可能有点乏味(见上文:应该是 local\
还是 local\include\
?)。也许您可以在您的 Pi 上找到所有默认包含路径的环境设置,然后将其复制到您的 Windows 机器上。
编辑:我想我明白了:echo | gcc -v -E -
我设置 this toolchain on my Windows machine for my Pi (raspberry-gcc4.6.3-nosysroot.exe) and then I followed the instructions here 来同步我的 sysroot。
我在我的项目中使用了一个名为 WiringPi 的库,我已经确认它在同步的 sysroot 中:
然后我尝试编译它:
arm-linux-gnueabihf-gcc -Wall -O -c main.c
但我收到以下错误:
fatal error: wiringPi.h: No such file or directory
我需要做什么才能让编译器找到头文件?我认为同步 sysroot 的全部意义在于使这种事情起作用?
您必须通过 -I
argument. In the case above, -IC:\SysGCC\Raspberry\...\usr\local
. You may have to add more than one include path, depending on where the required files are scattered. You can also try to set gcc's environment variable(s).
找出正确的包含路径可能有点乏味(见上文:应该是 local\
还是 local\include\
?)。也许您可以在您的 Pi 上找到所有默认包含路径的环境设置,然后将其复制到您的 Windows 机器上。
编辑:我想我明白了:echo | gcc -v -E -