我正在使用缓存模拟器,执行时遇到以下错误。
我正在使用Ubuntu终端执行程序。
我不了解错误的问题,因为我将所有其他文件都映射到了主程序。

我是否需要将程序的路径设置到任何目录才能执行它们?

首先,为了授予权限,我执行了以下命令,这样我就不会出现“权限错误”

enter code here
chmodx +x ./csim.c


然后我执行了以下命令以最终执行程序

enter code here
./csim.c [-hv] -s 5 -E 1 -b 5 -t traces/long.trace


输出端子错误

./csim.c: line 1: /bin: Is a directory
./csim.c: line 2: cachelab.c: command not found
./csim.c: line 3: cachelab.c: command not found
./csim.c: line 4: cachelab.c: command not found
./csim.c: line 5: cachelab.c: command not found
./csim.c: line 6: cachelab.c: command not found
./csim.c: line 7: cachelab.c: command not found
./csim.c: line 8: cachelab.c: command not found
./csim.c: line 9: cachelab.c: command not found
./csim.c: line 10: cachelab.c: command not found
./csim.c: line 11: traces/: Is a directory


我怎样才能解决这个问题 ?

最佳答案

您试图执行一个C源代码文件,该外壳程序将其解释为Shell脚本,因为您已为其指定了“可执行”模式。

首先要做的是编译C文件,例如

cc csim.c -o csim


...,然后运行生成的可执行程序。

./csim [-hv] -s 5 -E 1 -b 5 -t traces/long.trace

08-04 16:37