现在的位置: 首页 > 综合 > 正文

warning: extra tokens at end of #include directive

2014年09月16日 ⁄ 综合 ⁄ 共 734字 ⁄ 字号 评论关闭

用gcc编译源文件时出现的.

collect2: ld returned 1 exit status

这个错误究其原因应该是这个:某些自定义函数在头文件中声明了,在实现文件却没有用到。

下面是各种情况,自己查找错误原因时,碰到的。

Given a huge project on C++ - hundreds of files. Now it is obvious,

that there are too many unnecessary #includes both in .h and .cpp

files. Also it is obvious, that in many cases #includes can be

replaced by forward declarations. However due to huge number of files

it is near to impossible to optimize this by hands.

Is there some tool, which can optimize includes automagically?

Nice to have:

1) Remove double includes (A.h includes B.h, but .cpp file includes

both A.h and B.h)

2) Remove unneeded includes

3) Replace #include with forward declaration in .h and move #include

to .cpp

4) Replace one "super" #include, which includes a lot of .h with one

or more #includes, which includes only needed stuff.

5) Show #include graph, statistics, hints

6) Etc.

抱歉!评论已关闭.