从发布的文件中删除 PDB 引用 [英] Remove PDB references from released file

查看:49
本文介绍了从发布的文件中删除 PDB 引用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在调试和使用任何 IDE 创建文件后,我总是查看最终的二进制可执行文件或 dll.现在我正在尝试 Visual C++ 2010,以寻找最好的版本,没有垃圾或不必要的引用.因此,我创建了一个包含两个项目的新解决方案:一个可执行文件及其 dll.VC++ 在代码和最终文件之间创建了很多中间文件.我用十六进制编辑器打开了 .exe 和 .dll,看到了一些我不喜欢的东西.文件中的某处有一个到 .PDB 文件的绝对路径.

I use to take always a look at the final binary executable or dll after debugging and creating a file with any IDE. Now I am trying Visual C++ 2010, in the search for the best release, without trash or unnecessary references. So, I created a new solution with two projects: a executable and its dll. VC++ created a lot of intermediary files between the code and the final file. I opened the .exe and the .dll with a hexadecimal editor and saw something that I don't like. Somewhere inside the file there's an absolute path to the .PDB file.

为什么?如何从 VC++ 中删除它?

Why? How can I remove it from VC++?

为此必须有一些预处理器命令..PDB 文件的绝对路径的用途是什么,例如 "D:\My Projects\Project1\Release\Project1.pdb" 在一个文件的二进制文件中,该文件将在计算机上分发不同的文件夹?除此之外,我不希望看到我的驱动器路径之一保存在我想与其他人共享的二进制文件中.我处于发布模式,我没有看到使用那些不必要的信息.我怎么能去掉它?谢谢!

There must be some pre-processor command for this. What is the use of an absolute path to a .PDB file, like "D:\My Projects\Project1\Release\Project1.pdb" inside the binary of a file that will be distributed on computers with different folders? Beside that, I don't like to see one of my drive's routes saved inside a binary file that I want to share with other people. I am in Release mode, I don't see the use of that unnecessary information. How could I remove it? Thanks!

推荐答案

阅读 PDB 文件 MSDN 上的文档:

Read the PDB Files documentation on MSDN:

程序数据库 (PDB) 文件包含调试和项目状态信息,允许增量链接程序的调试配置.当您使用/ZI 或/Zi 编译 C/C++ 程序或使用/debug 编译 Visual Basic/C#/JScript .NET 程序时,会创建 PDB 文件.

A program database (PDB) file holds debugging and project state information that allows incremental linking of a Debug configuration of your program. A PDB file is created when you compile a C/C++ program with /ZI or /Zi or a Visual Basic/C#/JScript .NET program with /debug.

在 Visual C++ 中,/Fd 选项命名由编译器创建的 PDB 文件.在 Visual Studio 中使用向导创建项目时,/Fd 选项设置为创建名为 project.PDB 的 PDB.

In Visual C++, the /Fd option names the PDB file created by the compiler. When you create a project in Visual Studio using wizards, the /Fd option is set to create a PDB named project.PDB.

注意文档中提到了绝对路径:

Note that the absolute path is mentioned in the documentation:

Visual Studio 调试器直接使用链接器创建的 project.PDB 文件,并将 PDB 的绝对路径嵌入到 EXE 或 DLL 文件中.

The Visual Studio debugger uses the project.PDB file created by the linker directly and embeds the absolute path to the PDB in the EXE or DLL file.

您可以随时转到项目属性 >链接器调试生成调试信息并将其设置为否.

You can always go to Project Properties > Linker > Debugging > Generate Debug Info and set it to No.

这篇关于从发布的文件中删除 PDB 引用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆