小编bil*_*pcs的帖子

grep 得到编译错误

我已经创建了一个简单的 c 程序,并省略了一个 ';' 故意得到一个错误。我想使用grep命令来知道编译是否成功。

我用:

gcc test.c | grep 'error'但输出似乎不对。这是正确的方法吗?

我认为它不起作用,因为这样做:

echo"hello world" | grep "hello"我得到了匹配的彩色文本。

在为编译做 grep 时,没有这样的事情。

错误具有以下形式:

test.c: In function ‘main’:
test.c:8:2: error: expected ‘,’ or ‘;’ before ‘return’
  return 0;
  ^
Run Code Online (Sandbox Code Playgroud)

我使用的程序是:

int main(int argc, char const *argv[]){
    char f[] = "Hello thereeee!" 
    return 0;
}
Run Code Online (Sandbox Code Playgroud)

command-line compiling grep

1
推荐指数
1
解决办法
6557
查看次数

标签 统计

command-line ×1

compiling ×1

grep ×1