Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/c/58.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
SysGCC工具链在sysroot中找不到文件_C_Compilation_Compiler Errors_Raspberry Pi - Fatal编程技术网

SysGCC工具链在sysroot中找不到文件

SysGCC工具链在sysroot中找不到文件,c,compilation,compiler-errors,raspberry-pi,C,Compilation,Compiler Errors,Raspberry Pi,我在我的Windows机器上为我的Pi raspberry-gcc4.6.3-nosysroot.exe设置了工具链,然后按照说明同步我的系统根 我在我的项目中使用了一个名为WiringPi的库,我已经确认它位于synchronized sysroot中: 然后我尝试编译它: arm-linux-gnueabihf-gcc -Wall -O -c main.c 但我得到了以下错误: fatal error: wiringPi.h: No such file or directory 我必须做

我在我的Windows机器上为我的Pi raspberry-gcc4.6.3-nosysroot.exe设置了工具链,然后按照说明同步我的系统根

我在我的项目中使用了一个名为WiringPi的库,我已经确认它位于synchronized sysroot中:

然后我尝试编译它:

arm-linux-gnueabihf-gcc -Wall -O -c main.c
但我得到了以下错误:

fatal error: wiringPi.h: No such file or directory

我必须做什么才能让编译器找到头文件?我认为同步sysroot的全部目的就是让这类工作正常进行?

您必须通过参数让gcc知道在哪里查找include文件。在上述情况下,-IC:\SysGCC\Raspberry\…\usr\local。您可能需要添加多个包含路径,具体取决于所需文件的分散位置。您还可以尝试设置gcc

找到正确的include路径可能有点繁琐,请参见上文:它应该是local\还是local\include\?。也许您可以在Pi上找到所有默认包含路径的环境设置,然后将其复制到Windows计算机上


编辑:我想我知道了:

我如何在Windows上设置这些路径?我可以在Windows的环境变量配置中执行此操作吗?可以将它们作为命令行参数-I传递给gcc,或者设置环境变量,或者在makefile或IDE项目中声明它们。是的,通常的Windows环境。变量应该起作用。更改一个后,所有使用它们的父进程都应退出并重新启动;这包括打开的窗口和MinGW控制台。