DirectX Release build works through VS2010, but no

2019-05-19 13:49发布

问题:

I've been dropping by Stack Overflow for a few years now via Google, but haven't asked/answered anything as of yet, so here goes.

Basically I have a 3D rendering framework set up drawing models and terrain in DirectX 11. Everything works fine, with no problems when running either Debug or Release builds through Visual Studio 2010.

However, when I navigate into my folders and run the executables independantly, only the Debug build works. The Release build displays whatever clear colour I have set, but no geometry, although the framerate looks as though it's running, and my mouse is locked to the center of the window (togglable with middle mouse button), as though the program is running fine.

My first thought was that my content was failing to load, as that had this effect in an old project, but this project crashes if that happens, and running the exe through PIX has confirmed that all assets are loaded correctly.

The problem is proving difficult to google, so if anyone has any idea what could cause this, it'd be much appreciated. I'd post some code if it helped, but I don't see what would be relevant.

回答1:

Deadlines loomed and more important matters subsided, so I did some fiddling with build configurations.

Turns out that in the default debug configuration, C/C++, Code Generation, Runtime Library is set to 'Multi-threaded Debug DLL (/MDd)'. In release this is set to 'Multi-threaded DLL (/MD)'. Switching this setting to match the release configuration results in a build which runs through visual studio, but displays a black screen outside of it.

I still have no idea of the cause of this, so any other answers would be appreciated.