Visual Studio 构建中的静态对象

发布于 2024-10-01 10:07:53 字数 150 浏览 3 评论 0原文

我的 Visual Studio - 08 版本有问题。一些静态对象没有被实例化。它很奇怪,我有几个创建类似静态对象的文件。有些是被创建的,有些则不是。当我尝试在文件中为未创建的对象断点时,我的断点被禁用。

我如何确保创建所有静态对象。

谢谢, 阿比奈。

I have a problem with my visual studio - 08 build. some of the static objects are not getting instantiated. its wierd, i have a couple of files which create similar static objects. some are created some are not. when i tried to break point in the file for uncreated objects, my breakpoint is disabled.

how do i make sure all static objects are created.

Thanks,
Abhinay.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

往昔成烟 2024-10-08 10:07:53

这些文件是直接在您的主项目中,还是在静态库中?当您创建静态库时,链接器仅从以某种方式使用的目标文件中提取全局变量(并调用其构造函数)。

如果您确实有静态库,则必须确保每个文件都由主程序调用的函数使用。获取该文件中某个全局变量的地址是实现此目的的一种方法。

Are these files directly in your main project, or are they in a static library? When you make a static library, the linker only pulls in global variables (and calls their constructors) from object files that are somehow used.

If you do have a static library, you'll have to make sure each of the files is used by a function called by the main program. Taking the address of some global variable in that file is one way to do this.

似最初 2024-10-08 10:07:53

您的项目有多个副本吗?如果这样做,请转到主项目文件夹,删除与“intellisense”相关的文件,然后重新加载项目。这应该有效。

Do you have several copies of your project? If you do, go to your main project folder, delete the file related to "intellisense", then reload the project. This should work.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文