在非开发机器上运行vc2008调试版本 [英] Running vc2008 debug builds on non-dev machines

查看:88
本文介绍了在非开发机器上运行vc2008调试版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在vc2008中构建我的应用程序,并在机器网络上对其进行测试.

I'm building my app in vc2008 and testing it on a network of machines.

除了安装Visual Studio 2008以外,还有其他方法可以在另一台计算机上运行C ++程序的调试版本吗? (即未安装vc2008)

Is there any way, other than installing Visual Studio 2008, to run a debug build of a C++ program on another machine? (i.e. that doesn't have vc2008 installed)

安装redist软件包仅安装vc2008程序的发行模式支持DLL.目前,它抱怨此应用程序启动失败,因为应用程序配置不正确.重新安装该应用程序可能会解决此问题.",我认为这是我缺少DLL的代码".

Installing the redist package only installs the release mode support DLL's for vc2008 programs. Currently it complains that "This application has failed to start because the application configuration is incorrect. Reinstalling the application may fix this problem.", which I assume is code for "I'm missing DLL's".

推荐答案

您不能,因为没有用于调试运行时的安装程序重装程序(实际上,软件许可证禁止分发它,因此您将违反EULA)即使您确实整理了一些东西).但是,调试版本"通常包含4个单独的选项,其他3个选项不影响应用程序的分发.

You can't, because there's no installer redist for the debug runtime (and in fact the software license forbids distributing it, so you'd be breaking the EULA even if you did get something put together). However, a "debug build" generally involves 4 separate options, and the other 3 don't affect distributing the app.

  1. 生成一个.pdb文件(cl/Zi和链接/DEBUG),该文件允许进行符号调试.您可能想将/OPT:ref添加到链接器选项中;链接器在未制作.pdb文件时会丢弃未引用的函数,但在/DEBUG模式下,除非您明确添加,否则它将保留所有未引用的函数(因为调试符号引用了它们).

  1. Generating a .pdb file (cl /Zi and link /DEBUG), which allows symbolic debugging. You probably want to add /OPT:ref to the linker options; the linker drops unreferenced functions when not making a .pdb file, but with /DEBUG mode it keeps them all (since the debug symbols reference them) unless you add this expicitly.

通常,我会使用我所有的构建,甚至是生产构建.只要您使用/OPT:ref重新打开链接器优化,它实际上并不会花费任何费用,而且如果您最终想要读取故障转储,则具有符号会很方便.

I generally do this with all my builds, even production ones. As long as you turn the linker optimizations back on with /OPT:ref it doesn't really cost anything, and having the symbols can be handy if you end up wanting to read a crash dump.

使用C运行时库的调试版本(可能是MSVCR * D.dll,但这取决于您使用的运行时).可以归结为/MT或/MTd(如果不使用dll运行时,则可以归为其他).

Using a debug version of the C runtime library (probably MSVCR*D.dll, but it depends on what runtime you're using). This boils down to /MT or /MTd (or something else if not using the dll runtime).

这是意味着您不能再分配任何东西的那个.它也对某些自由函数的性能产生巨大影响,尤其是内存分配.调试运行时版本会小心地使用值毒化"它们接触的内存,以清除未初始化的数据错误,而发行版本通常会将旧数据保留下来以节省接触它的时间.我相信使用MSVCP * STL实现时,调试版本还会忽略通常完成的所有分配池,以便泄漏检查器可以准确显示您要考虑的块,而不显示它正在子分配的更大的内存块,但这意味着在它们之上进行对malloc的更多调用要慢得多.如果您有处理错误的指针或迭代器,则这可能会影响您得到哪种错误行为.

This is the one that means you can't redistribute things anymore. It also has a huge impact in the performance of some libraty functions, particularly memory allocation. The debug runtime versions are careful to "poison" the memory they touch with values to make uninitialized data bugs clear, the release ones generally leave the old data round to save the time touching it. I believe with the MSVCP* STL implementations the debug verions also omit all the allocation pooling that is usually done, so that a leak checker can show exactly the block you'd think and not some larger chunk of memory that it's been sub-allocating, but that means it makes more calls to malloc on top of them being much slower. If you have pointer or iterator handling bugs, this could affect what sort of misbehavior you get.

关闭编译器优化(/Od).

Turning off the compiler optimizations (/Od).

这件事做了很多事情(

This one does lots of things (this question has some good discussion of the subject), but basically it hurts performance. A lot. Unfortunately, it's needed if you want single-stepping to work smoothly.

设置预处理器#定义DEBUG或NDEBUG.

setting the preprocessor #defines DEBUG or NDEBUG.

这会以各种方式影响许多库,但是最值得注意的是,它可以编译或消除assert()和朋友.

This affects lots of libraries in various ways, but most notable it compiles in or eliminates assert() and friends.

因此,您可以考虑使用这些选项的较小组合来进行构建.我大量使用带有符号(/Zi和链接/DEBUG)和断言(/DDEBUG)的构建,但仍进行了优化(/O1或/O2或您使用的任何标志),但保留了堆栈帧指针清除回溯(/Oy-)并使用正常的运行时库(/MT).这与我的发布版本很接近,并且是半可调试的(回溯很好,在源代码级别,单步执行有些怪异;汇编级别当然可以工作).但是,您可以拥有许多所需的配置.只需克隆您的发行版,然后打开调试中似乎有用的任何部分即可.

So you might consider making a build with some lesser combination of these selections. I make a lot of use of builds that use have symbols (/Zi and link /DEBUG) and asserts (/DDEBUG), but are still optimized (/O1 or /O2 or whatever flags you use) but with stack frame pointers kept for clear backtraces (/Oy-) and using the normal runtime library (/MT). This performs close to my release build and is semi-debuggable (backtraces are fine, single-stepping is a bit wacky at the source level; assembly level works fine of course). You can have however many configurations you want; just clone your release one and turn on whatever parts of the debugging seem useful.

影响重新尝试分发应用程序的唯一因素是2.

The only one that should impact trying to redistribute the app is 2.

如果您尝试在另一台计算机上进行调试,则可能对

If you're trying to debug on another machine, you might also be interested in msvsmon.

这篇关于在非开发机器上运行vc2008调试版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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