0

I am in big big trouble. Please help. I have created a game for my client. It works fine when I run it from the Visual Studio 2008( in both release and debug configuration).

But when I run its stand alone exe (or making setup project) it does not work perfectly fine. It works but it does not work completely fine,and the problem is consistent(It shows the same problem every time, when I compile and run stand alone exe).

I had this problem in the past too but luckily I solved it.The way that problem was solved is very unusual:- Every thing was working perfectly fine and then I made some modifications in the code.The application started showing the same unusual behavior as described above.Then i started rolling back the modifications in the code one by one. The game started working perfectly fine when i removed a particular variable from a class and it uses.Then I checked all the C++ rules and every thing but found no issue in my implementation.Even every thing was working fine when i run from the Visual Studio. But I needed that variable and its uses in the game for some functionality of the game.So, that time I declared the variable in PUBLIC (previously it was a protected variable) and every thing worked perfectly fine.

I am very surprised to see this unusual behavior, whenever i declare the variable as PROTECTED there is problem but if I copy and paste in Public the problem is solved.(The variable is only being used in the Class where it is declared so there should not be any problem).

Please Help me I am again getting this unusual problem and not getting any solution this time.

Please tell me what may cause this problem. Thanks Tarun

5
  • 2
    You haven't described what the problem is? Commented Nov 10, 2010 at 12:03
  • 1
    what exactly is the problem you are getting on client machine? is it a crash or something else? Commented Nov 10, 2010 at 12:04
  • "does not work completely fine" is not something I would call a useful problem description. Commented Nov 10, 2010 at 12:05
  • Did you do a full rebuild before release it? Commented Nov 10, 2010 at 12:33
  • Maybe you can debug the problem if you attach to process. Commented Nov 10, 2010 at 12:35

3 Answers 3

3

If it happens outside the debugger, but not inside the debugger, you may be able to reproduce it using the _NO_DEBUG_HEAP environment variable, as described here (amongst other places): Link

Setting this variable should make the program running under the debugger behave more like the program running outside the debugger.

You can set environment variables in Visual Studio, so they affect only the debugged process: How do I set specific environment variables when debugging in Visual Studio?

Sign up to request clarification or add additional context in comments.

2 Comments

I am unable to solve this problem. Please help me!!! How can I mimic the same condition as under the IDE.
Did you try the above? Or attaching to process, as others suggested? Aside from those, it's hard to provide any specific suggestions. Fortunately while this sort of bug can be difficult to isolate the fix is usually very straightforward.
1

Changing the visibility of member variables can potentially change the layout of the class, since C++ only defines an ordering within visibility sections, not between them. Perhaps your change is breaking some code that isn't recompiled by your project.

1 Comment

yes..this looks like the most probable explanation with the information provided by OP.
0

I solved this problem. It was really very very hard to find the solution. I am writing here how to track this kind of bugs. Some steps you should try first:- 1) Dont ignore compiler warnings. Remove all types of warnings. 2) Program to write the states of the variable in a file in near the critical portion of your program where you are in doubt that is causing error. Write the states on each step. Examin the Variable, you may find some un initialize variables or improper type cast or comarison.

Conclusion: 1) Avoid any coparison (equal to comparison)with floating point values. 2) If you are making time based comparison, make sure you comapre that care fully. 3) Do not this Microsoft People are god.

1 Comment

you should not compare floats on equality ,but less or greater or a range comparisson are fine.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.