这些来自gcc的意思是什么?

时间:2017-02-20 10:25:54

标签: gcc macros c-preprocessor

我在终端上运行了一个prova.c文件 我用命令行运行GCC:

if [[ $f != */.* ]]; then
        echo "$f"
        command-one || { echo 'Something went wrong with Command-one at file ' $f ' !' >> ../corrupted.txt } || error=1
        command-two || { echo 'Something went wrong with Command-two at file ' $f ' !' >> ../corrupted.txt } || error=1
        command-three || { echo 'Something went wrong with Command-three at file ' $f ' !' >> ../corrupted.txt } || error=1
        if [ error == 0 ]
        then
            echo "====================================================" >> ../ok.txt
            echo "All went well with: " $f >> ../ok.txt
        fi
        error=0
    else
        echo "This file is corrupted: " $f >> ../corrupted.txt
    fi

prova.c:

gcc -Wall -std=c99 -E prova.c  


标准输出:

 int main(int argc, char* argv[]) {
           int a=1;
           int b=2;
           return a+b;   
    }

开头的哈希每行是什么意思?
为什么我们需要它们来生成? 如果你有时间,我希望对每一行都有一个解释,而不是一般的答案。我知道其中一些是行标记 如果您知道有关共享主题的资源就会很棒。

1 个答案:

答案 0 :(得分:0)

这不是一个完整的答案,如你所愿,但它可以给你一些提示。

-E的{​​{1}}参数确实(link)

  

在预处理阶段后停止;不要正确运行编译器。输出采用预处理源代码的形式,发送到标准输出。

这解释了你得到的命令gcc。现在,您可以转到有关预处理器输出here的文档。它说:

  

“1”       这表示新文件的开始。

我不确定# 1块内的命令。