Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I have a c++ application which outputs to screen using entirely DirectX9, running on Win7 64 Home.

It runs as normal in these circumstances:

  • Debug Build, from within MSVC 2008.
  • Release Build, from within MSVC 2008.
  • Debug Build, by opening the compiled executable itself.

However, strange things happen when I run the compiled executable of the release build. The window is created as expected but no screen output. Nothing.

I can hear the sound working and the log file fills up. I thought maybe the working directory was wrong when running the executable but the log file reports the CWD is correct and indeed all filepaths to data files work.

I am stumped as to why my application will work fine in 3 of the four permutations, but not the most important one - the standalone release executable!

If anyone can contribute, I'd be most grateful.

Thanks

Si

share|improve this question

migrated from stackoverflow.com Jul 11 '11 at 11:05

This question came from our site for professional and enthusiast programmers.

add comment

4 Answers 4

Attach the debugger to the version not started from within VS, and debug through to see what is going on. To help you catch the early part of the program, you can put a dialog box or __debugbreak into the early part so you can attach early and see the DX surfaces being created and so on.

Martyn

share|improve this answer
    
Thanks for the advice. Unfortunately as I already mentioned, the debug version works well from within MSVC and as an exe. Attaching to the release exe doesnt show me anything, as it is not built with debug info. –  sipickles Jul 9 '11 at 20:25
1  
So you should enable building debug symbols for the release build [this is enabled by default in the IDE]. You can then debug the release one. Code generation is not impacted by building PDBs. –  Martyn Lovell Jul 9 '11 at 21:56
    
Follow Martyn's great advice and realize that you can use the debugger on anything, even running executables not built in "debug mode." If you've turned on the symbols you can even load the EXE in the debugger and set breakpoints before you start the run. –  Patrick Hughes Jul 11 '11 at 16:24
add comment

the difference between running with the IDE attached at startup is usually that the state of the memory handed to you by the allocator is not the same. If I remember correctly, it's zeroed out or filled with garbage (I can't rememeber which as we don't use standard allocators any more).

Checking memory should be your first approach vector. Make sure all your allocations assume that the memory is dirty and initialise them.

share|improve this answer
add comment

Please use DirectX SDK Utilities - DirectX Control Panel and see if you are not getting an error.

Set Debug level in control pannel, recompile your application and you should see runtime errors in the Output window

share|improve this answer
add comment

Build your program with the highest warning level turned on, see if it catches any uninitialized variables.

Make sure that you're checking all return values from system calls.

Follow the advice to use the debug DirectX/D3D driver and watch its output to see what changes between the working code and the broken.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.