文件导入

solaris 11 stdio.h: No such file or directory

在Solaris 11下使用gcc编译器,安装编译器
[bash]
pkg install gcc-45 或者 pkg install gcc-3
[/bash]
数字是gcc版本号

但是在进行编译时,会出现头文件错误,最基本的stdio.h也找不到

[bash]
root@solaris11:~# cat hello.c
[/bash]
[c]
#include <stdio.h>
int main(int argc, char* argv[])
{
while (1) {
getchar();
}
return 0;
}
[/c]
[bash]
root@solaris11:~$ gcc hello.c
[/bash]
[plain]
hello.c:1:19 fatal error: stdio.h: No such file or directory
[/plain]
[bash]
root@solaris11:~$ slocate stdio.h
[/bash]
[plain]
/usr/include/glib-2.0/glib/gstdio.h
/usr/include/libgsf-1/gsf/gsf-output-stdio.h
/usr/include/libgsf-1/gsf/gsf-outfile-stdio.h
/usr/include/libgsf-1/gsf/gsf-input-stdio.h
/usr/include/libgsf-1/gsf/gsf-infile-stdio.h
/usr/include/ast/ast_stdio.h
/usr/include/ast/stdio.h
/usr/gcc/4.5/lib/gcc/i386-pc-solaris2.11/4.5.2/include/ssp/stdio.h
[/plain]

用slocate寻找,找到了很多头文件,可是没用,难道是链接库的位置错误?不是,默认的solaris 11并没有安装完整的头文件,只需要安装system/header即可
[bash]
pkg install system/header
[/bash]
这样就可以正常编译了,而solocate的结果里也会多出一项 /usr/gcc/4.5/include/c++/4.5.2/tr1/stdio.h

评论