清理 VC++ 6个项目
我正在处理一个非常古老且大型的 VC6++ 项目,它一团糟。到处都是未使用的文件和文件夹,文件夹的副本,在当前状态下手动清理它只是一团糟。
它最终会完成,但是有没有简单的方法来检查进行干净编译时使用了哪些文件和文件夹?
项目设置根本没有帮助我,因为它只使用文件夹和附加包含目录的副本。
有什么建议吗?
I'm working with a very old and large VC6++ project and it's all messed up. There are unused files and folders everywhere, copies of folders and it's just a mess to clean it up by hand in its current state.
It will be done eventually, but is there any simple way to check what files and folders are used when it does a clean compile?
The project settings doesnt help me at all because it simply uses copies of folders and additional include directories.
Any suggestions?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
好吧,如果您想解析编译器输出,您可以获取实际使用的文件。我还找到 当谷歌搜索时,您可能想尝试一下(我自己还没有尝试过)。我的方法是清理构建,列出所有源文件,构建,并为每个源找到其相应的 .obj。不使用不带 .obj 的。请注意,这仅适用于源文件,未使用的头文件不会被检测到。
Well, if you want to parse the compiler output you can get which files are actually used. I also find this when googling around, you might want to try (I haven't tried it myself). My way would be to clean the build, list all source files, build, and for each source find its corresponding .obj. The ones without .obj are not used. Note that this only works for source files, unused header files stay undetected.
VC6 将为您生成一个 makefile:
您可以使用生成的 makefile (以及关联的 .dep 文件)作为起点,并将其编辑到构建中使用的文件列表。
除了可能显示的
.c
/.cpp
/.lib
文件之外,这还可以让您看到项目依赖的头文件在构建日志中。需要记住的一件事是,您可能还需要确保跟踪.dsw
和.dsp
工作区和项目文件。如果您有点冒险精神,您也许可以说服 makefile 通过适当覆盖某些宏和/或依赖项,将源文件实际复制到其他位置。但这可能会带来更多的麻烦,而不是一次性的努力所值得的。
最后,还有一个商业产品,Kinook Software 出品的 CopyWiz,它的功能似乎可以满足您的需求正在寻找(并且它支持 VC++ 6)。注意:我不确定它是否会达到您想要的效果,但可能值得一看。
VC6 will produce a makefile for you:
You can use the generated makefile (and the associated
.dep
file) as a starting point and edit it down to the list of files that get used in a build.This will let you see the header files that the project depends on in addition to the
.c
/.cpp
/.lib
files that might show in the build log. One thing to keep in mind is that you'll probably also want to make sure you track the.dsw
and.dsp
workspace and project files.If you're a bit adventurous, you might be able to convince the makefile to actually copy the source files to some other location for you with an appropriate override of the certain macros and/or dependencies. But that would probably be more trouble than it's worth for a one-time effort.
Finally, there's a commercial product, CopyWiz by Kinook Software, that seems to have features that might do what you're looking for (and it supports VC++ 6). Note: I'm not sure if it will do what you want, but it may be worth a look.
是的。从 SysInternals 运行进程监视器。它可以捕获所有文件系统事件并根据路径和其他因素对其进行过滤。
因此,将过滤器设置为源代码树的根目录,仅成功读取文件(VC 在许多地方查找标头),然后构建项目。您可能仍然会看到数千个事件。因此,将它们保存到文件中,按路径排序,并删除重复的路径(尤其是标头会有许多重复的条目)
Yes. Run Process Monitor from SysInternals. It can capture all file system events and filter them based on the path and other factors.
So, set the filter to the root of your source tree, only succesfull file reads (VC looks for headers in many places), and build your project. You'll probably still see several thousand events. So, save them to file, sort by path, and remove duplicate paths (headers especially will have many duplicate entries)