免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 807 | 回复: 0
打印 上一主题 下一主题

Preprocessed File - A Useful Tool in Development [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2008-10-15 14:52 |只看该作者 |倒序浏览
A special file, preprocessed file, is usually useful for our development. Supposed that when we are building a large project containing some header files with same name in different directories, an error occurs when some file is compiling, indicating that some symbol is not defined. After long time checking source code, we could not find out the root cause since the corresponding header file has been included. In this case, the preprocessed file could help us locate the root cause.
First of all, let's explain how to generate the preprocessed file. There are two methods to generate the preprocessed files:
1) Use option -E
gcc -c hello.c -E -o hello.i
2) Use option -save-temps
gcc -c hello.c -o hello.o -save-temps
These two methods will all generate the preprocessed hello.i, which is generated by the preprocessor of gnu toolchains.
Then you can open the file, and find whehter the file contains the missed symbol. Obviously, maybe the wrong header file with same name in other folder is included in your source code.
Above example is just a simple usage of the preprocessed file. Since this file contains all variables and functions defined in the included files, it will provide all what you want to see in the target file.


本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u1/48729/showart_1302756.html
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP