編譯我有不尋常的編譯時錯誤,當我編譯下面的代碼:在目錄「無法打開/tmp/ccRBTake.s寫作」,而用gcc
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
int main()
{
if (open("b.txt", O_CREAT | O_RDWR | O_TRUNC, 0777) < 0) {
perror("open error:");
exit(1);
}
return 0;
}
,這沒有按」 t包含b.txt
。
以下是錯誤:
test.c:1:0: fatal error: can’t open /tmp/ccrlx6NY.s for writing: Permission denied
compilation terminated.
The bug is not reproducible, so it is likely a hardware or OS problem.
我使用GNU/Linux (3.2.0-39-generic)
操作系統和gcc
編譯器版本4.6.3。
$df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sda5 44240004 10753148 31239588 26%/
udev 1004132 4 1004128 1% /dev
tmpfs 406548 1228 405320 1% /run
none 5120 0 5120 0% /run/lock
none 1016364 236 1016128 1% /run/shm
/dev/sda7 80731936 47718056 28912916 63% /home
什麼可能是確切的原因,我得到這個消息? PS:我現在實際上在編譯的每個文件上都出現這個錯誤。
你可以嘗試'chmod + w/tmp'並重新運行編譯? – Ganesh 2013-03-22 07:15:38
@Ganesh我嘗試'chmod'仍然給出同樣的錯誤。 – mohit 2013-03-22 07:17:38
您能向我們展示您的編譯調用的完整命令行嗎? – 2013-03-22 07:23:45