How do I find out why g++ takes a very long time on a particular file?

后端 未结 8 1390
日久生厌
日久生厌 2021-02-01 21:51

I am building a lot of auto-generated code, including one particularly large file (~15K lines), using a mingw32 cross compiler on linux. Most files are extremely quick, but thi

8条回答
  •  名媛妹妹
    2021-02-01 22:18

    Related to @Goz and @Josh_Kelley, you can get gcc/g++ to spit out the preprocessed source (with #includes inline) using -E. That's one way to determine just how large your source is.

    And if the compiler itself is the problem, you may be able to strace the compile command that's taking a long time to see whether there's a particular file access or a specific internal action that's taking a long time.

提交回复
热议问题