如何在linux环境下编译c代码


How to compile c code in linux environment

我使用fedora 14和gcc编译器编译c代码。使用php(lampp),我试图调用helloworld。我正在尝试以下代码

exec('gcc hello.c', $x,$y);
echo $x; //line 4
echo "<br/>>>> "; 
echo $y;

 Notice: Array to string conversion in /opt/lampp/htdocs/learning/index.php on line 4
Array
>>> 1

任何关于如何编译和获得输出的想法。Plz帮助:)

我做了

 $compilecode=shell_exec("gcc -o hello hello.c 2>&1");
 Output:
 failed to create /var/cache/ccache/tmp (Permission denied) in echo. 

什么权限问题。

yum-remove-cache完成了