Jump to content
  • Advertisement
Sign in to follow this  
GenericName

Creating a Usable Executable in VS2010

This topic is 2448 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

So, I'm sure that an answer to my question already lies somewhere, but I've spent a good deal of time searching for it to no avail.

I've written some code in Visual Studio 2010 that utilizes DirectX11 to draw some images and am trying to export it to an executable so I can run it on another computer. The problem is that when I run the executable that is created during debug (even the one in the VS2010 debug folder), all that happens is that a window pops up for the program and the closes immediately.

I've already gone through and tried changing some of the MFC and multithreading settings in the project properties, but I get the same results every time (although the size of the .exe changes). The project always compiles and runs as intended inside of VS2010 but can't launch from the executable, closing with no error messages.

I'm something of a beginner when it comes to DirectX, so I don't understand what the cause of this problem could be. Can anyone help me?

Share this post


Link to post
Share on other sites
Advertisement
Probably need to put the .dll's you're using into the same directory as your exe

Share this post


Link to post
Share on other sites
Nope, no DLLs, and the last thing you should be doing is randomly copying DLLs around.

Use the proper installers where required and everything will be set up correctly for you and you won't have to deal with DLL version conflicts in the future. That's why proper installers are provided.

First thing you should check is that you're linking with the correct C/C++ runtime - it's occasionally the case that a new MSVC project wants to link with the DLL version of the runtime, which may not be on the target machine. Set it up to link with the non-DLL version (i.e. "Multithreaded Debug" instead of "Multithreaded Debug DLL") and see what happens.

Share this post


Link to post
Share on other sites
You mean the runtime library in C/C++ code generation, right? I changed it to Multithreaded Debug (/MTd) and didn't get any different results.

Share this post


Link to post
Share on other sites
So I'm finally (ha) done with finals week. Thanks for all the input so far; I think I might be getting close to a solution.

I do have a primary loop. I figured that the problem was unrelated to my code because it runs as intended within Visual Studio. It fails in the executable as soon as I try to load a vertex shader during my initialization function, but I feel like that isn't too important.

bool GameSprite::LoadContent()
{
ID3DBlob* vsBuffer = 0;
bool compileResult;
compileResult = CompileD3DShader("TextureMap.fx", "VS_Main", "vs_4_0", &vsBuffer);
if(compileResult == false)
{
DXTRACE_MSG("Error compiling the vertex shader!");
return false;
}


I also found this in the output:


'GameSprites.exe': Loaded 'C:\Users\Owner\Documents\Visual Studio 2010\Projects\GameSprites\Debug\GameSprites.exe', Symbols loaded.
'GameSprites.exe': Loaded 'C:\Windows\SysWOW64\ntdll.dll', Cannot find or open the PDB file
'GameSprites.exe': Loaded 'C:\Windows\SysWOW64\kernel32.dll', Cannot find or open the PDB file
'GameSprites.exe': Loaded 'C:\Windows\SysWOW64\KernelBase.dll', Cannot find or open the PDB file
'GameSprites.exe': Loaded 'C:\Program Files\AVAST Software\Avast\snxhk.dll', Cannot find or open the PDB file
'GameSprites.exe': Loaded 'C:\Windows\SysWOW64\d3d11.dll', Cannot find or open the PDB file
'GameSprites.exe': Loaded 'C:\Windows\SysWOW64\msvcrt.dll', Cannot find or open the PDB file
'GameSprites.exe': Loaded 'C:\Windows\SysWOW64\dxgi.dll', Cannot find or open the PDB file
'GameSprites.exe': Loaded 'C:\Windows\SysWOW64\user32.dll', Cannot find or open the PDB file
'GameSprites.exe': Loaded 'C:\Windows\SysWOW64\gdi32.dll', Cannot find or open the PDB file
'GameSprites.exe': Loaded 'C:\Windows\SysWOW64\lpk.dll', Cannot find or open the PDB file
'GameSprites.exe': Loaded 'C:\Windows\SysWOW64\usp10.dll', Cannot find or open the PDB file
'GameSprites.exe': Loaded 'C:\Windows\SysWOW64\advapi32.dll', Cannot find or open the PDB file
'GameSprites.exe': Loaded 'C:\Windows\SysWOW64\sechost.dll', Cannot find or open the PDB file
'GameSprites.exe': Loaded 'C:\Windows\SysWOW64\rpcrt4.dll', Cannot find or open the PDB file
'GameSprites.exe': Loaded 'C:\Windows\SysWOW64\sspicli.dll', Cannot find or open the PDB file
'GameSprites.exe': Loaded 'C:\Windows\SysWOW64\cryptbase.dll', Cannot find or open the PDB file
'GameSprites.exe': Loaded 'C:\Windows\SysWOW64\version.dll', Cannot find or open the PDB file
'GameSprites.exe': Loaded 'C:\Windows\SysWOW64\dwmapi.dll', Cannot find or open the PDB file
'GameSprites.exe': Loaded 'C:\Windows\SysWOW64\d3dx11_43.dll', Cannot find or open the PDB file
'GameSprites.exe': Loaded 'C:\Windows\SysWOW64\ole32.dll', Cannot find or open the PDB file
'GameSprites.exe': Loaded 'C:\Windows\SysWOW64\imm32.dll', Cannot find or open the PDB file
'GameSprites.exe': Loaded 'C:\Windows\SysWOW64\msctf.dll', Cannot find or open the PDB file
'GameSprites.exe': Loaded 'C:\Windows\SysWOW64\uxtheme.dll', Cannot find or open the PDB file
'GameSprites.exe': Loaded 'C:\ProgramData\Real\RealPlayer\BrowserRecordPlugin\Chrome\Hook\rpchrome10browserrecordhelper.dll', Cannot find or open the PDB file
'GameSprites.exe': Loaded 'C:\Windows\winsxs\x86_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.30729.6161_none_50934f2ebcb7eb57\msvcr90.dll', Cannot find or open the PDB file
'GameSprites.exe': Loaded 'C:\Windows\SysWOW64\shell32.dll', Cannot find or open the PDB file
'GameSprites.exe': Loaded 'C:\Windows\SysWOW64\shlwapi.dll', Cannot find or open the PDB file
'GameSprites.exe': Loaded 'C:\Windows\winsxs\x86_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.30729.6161_none_50934f2ebcb7eb57\msvcp90.dll', Cannot find or open the PDB file
'GameSprites.exe': Loaded 'C:\Windows\SysWOW64\clbcatq.dll', Cannot find or open the PDB file
'GameSprites.exe': Loaded 'C:\Windows\SysWOW64\oleaut32.dll', Cannot find or open the PDB file
'GameSprites.exe': Loaded 'C:\Windows\SysWOW64\setupapi.dll', Cannot find or open the PDB file
'GameSprites.exe': Loaded 'C:\Windows\SysWOW64\cfgmgr32.dll', Cannot find or open the PDB file
'GameSprites.exe': Loaded 'C:\Windows\SysWOW64\devobj.dll', Cannot find or open the PDB file
'GameSprites.exe': Loaded 'C:\Windows\SysWOW64\wintrust.dll', Cannot find or open the PDB file
'GameSprites.exe': Loaded 'C:\Windows\SysWOW64\crypt32.dll', Cannot find or open the PDB file
'GameSprites.exe': Loaded 'C:\Windows\SysWOW64\msasn1.dll', Cannot find or open the PDB file
'GameSprites.exe': Unloaded 'C:\Windows\SysWOW64\setupapi.dll'
'GameSprites.exe': Unloaded 'C:\Windows\SysWOW64\devobj.dll'
'GameSprites.exe': Unloaded 'C:\Windows\SysWOW64\cfgmgr32.dll'
'GameSprites.exe': Loaded 'C:\Windows\SysWOW64\atidxx32.dll', Cannot find or open the PDB file
'GameSprites.exe': Loaded 'C:\Windows\SysWOW64\D3D11SDKLayers.dll', Cannot find or open the PDB file
'GameSprites.exe': Loaded 'C:\Windows\SysWOW64\D3DCompiler_43.dll', Cannot find or open the PDB file
'GameSprites.exe': Loaded 'C:\Windows\SysWOW64\WindowsCodecs.dll', Cannot find or open the PDB file

(Wish I could have put that in a spoiler or something)

So I guess my .dlls aren't linking right because because they're loaded in the address on my machine?

Share this post


Link to post
Share on other sites
Those aren't errors and perfectly normal messages telling you that you don't have debug information for your windows dlls. Which you don't unless you felt the need to actually download them.

Since I doubt you are dynamically loading dlls and manually extract function pointers, the fact that your program starts without any errors about missing dlls means that it is working. If it just shuts down again chances are your paths are wrong and you abort somewhere because you can't find your resources.

Some simple debug outputs to the console and a (quick and dirty) "getchar();" at the end of main can help when running in a debugger isn't an option. Or start using a log file. Or use dxtrace in all places that could abort the application. Also make sure you never blindly rely on successfully loading resources in a way that will just crash when it fails.

Share this post


Link to post
Share on other sites
When something runs in VS but not by directly running the executable, the problem is most likely that you are trying to load a file that isn't in the correct location.

When you run a program in VS, it will by default set the working directory to the project directory, when you run an executable directly the working directory will be the directory that the executable is in - which by default will be <project dir>/Debug or <project dir>/Release.

So if you have any relative paths, they will all be off. Try copying the executable and any dlls that your project generates from <project dir>/Debug to <project dir>

The working directory when running in VS is set in the project properties -> Debugging -> Working Directory.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

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

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!