Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

This topic is 6651 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Are there limits as to how many objects you can have in a function or program in c++? When I had 2 objects in my winmain it would complile but crash and exit when run. I moved one of the objects out of the winmain and made it global and it compiles and run flawlessly. Are there limits on memory for varialbes used in functions and if so what are they and how can they be altered. OneEyeLessThanNone - needs gramar school.

Share this post


Link to post
Share on other sites
Advertisement
The only limit is essentially the virtual memory in your computer. There should be no reason that your program crashed just because you have two objects in your WinMain().

Share this post


Link to post
Share on other sites
This might have nothing to do with it, but your do you have the objects or pointers to them? I think that making them global inicializes them with 0, so it might make the difference if you have some code like

if(lpobject1!=0)
lpobject1 = new object1;

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!