Tanmay Kishore
Tanmay Kishore

Reputation: 9

How to run a DirectX Game through Command Prompt

I have a program for DirectX, written in C++. I have compiled it through Visual Studio, but I want to run that program through the Command Prompt. I tried to run a Sample Direct3D Game from the Command Prompt just to be sure, but it didn't work either. This Game works fine when I build it from Visual Studio 19 or Visual Studio 17, but I am not able to run it from the Command Prompt. Everytime I do, a window pops up with the following message.

The code execution cannot proceed because MSVCP140D_APP.dll was not found. Reinstalling the program may fix this problem.

The same message is displayed about vccorlib140d_app.Dll, CONCRT140D_APP.dll, and VCRUNTIME140D_APP.dll. However, I face no such issues when running the same program through Visual Studio. I've tried almost everything that I could find about this issue, but I couldn't solve it. The .exe file that I tried to run, is in the path: ..Direct3D_game_sample\cpp\x64\Debug\Simple3DGameDX

I also tried running a simple OpenCV program written in C++ to read and display a sample video file, but couldn't do so either. It runs perfectly through Visual Studio, but not through the Command Prompt. The OpenCV program returns the following errors.

warning: Error opening file (/build/opencv/modules/videoio/src/cap_ffmpeg_impl.hpp:940)
warning: vtest.avi (/build/opencv/modules/videoio/src/cap_ffmpeg_impl.hpp:941)
OpenCV(3.4.9) Error: Bad argument (CAP_IMAGES: cannot find starting number (in the name of file): vtest.avi) in cv::icvExtractPattern, file C:\build\3_4_winpack-build-win64-vc15\opencv\modules\videoio\src\cap_images.cpp, line 246
[ERROR:0] VIDEOIO(cvCreateFileCapture_Images(filename.c_str())): raised OpenCV exception:
OpenCV(3.4.9) C:\build\3_4_winpack-build-win64-vc15\opencv\modules\videoio\src\cap_images.cpp:246: error: (-5:Bad argument) CAP_IMAGES:cannot find starting number (in the name of file): vtest.avi in function 'cv::icvExtractPattern'

PS: I'm running Windows 10 on my machine and the Sample DirectX Game App uses DirectX 11.

Thanks in advance

Upvotes: 0

Views: 1391

Answers (1)

Chuck Walbourn
Chuck Walbourn

Reputation: 41077

Since your program is using the MSVCP140D_APP.dll version of the CRT, that means you built a Universal Windows Platform app (i.e. a UWP app). You can't run such an application as a Win32 application from the command-line and have it work. All the samples on the Windows-universal-samples GitHub are UWP apps.

You can use Powershell Commands to install and launch an appx package built from Visual Studio. See Microsoft Docs.

If what you want is a Win32 desktop application, then you need to build a different program. See directx-vs-templates for Win32 VS templates in the style of the "UWP" templates.

Upvotes: 1

Related Questions