我shell时的奇怪行为:
bush@ubuntu:~/CPPWorkspace/Ex12$ gcc users/dubi/justPrnit.C
返回错误:
gcc: error trying to exec 'cc1plus': execvp: No such file or directory
但是当我将justPrnit.C更改为justPrnit.c(带有小'c')时,它已成功编译。
那是什么?
答案 0 :(得分:8)
错误尝试执行'cc1plus'
因为假设.C
是C ++源文件(cc1plus
是GCC的C ++解析器后端 - 顺便说一句,看来你的本地GCC安装缺少g++
- 你使用默认的[不完整]设置吗?)。
要解决此问题,请使用-x
开关强制语言:
gcc -x c users/dubi/justPrnit.C
答案 1 :(得分:2)
GCC将.C
识别为C ++,而不是C