static objects in visual studio build
I have a problem with my visual studio - 08 build. some of the static objects a开发者_如何学JAVAre 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.
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.
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.
精彩评论