[Last Call] Learn how to a build a cloud-first strategyRegister Now

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 5341
  • Last Modified:

Error spawning 'cmd.exe' from VS 2005 pro, c++

For a while I have been programming with VS 2005 pro with C#, the complier works okay.

I move on into C++ to experiment with class and interface, I started off with simple hello world application. I created new project (via tutorial webpage) and use C++.

//=================================== main.cpp.
#include "stdafx.h"
#undef MessageBox
// Define our entry-point
int __stdcall WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
                                LPSTR lpStrCmdString, int nCmdShow)
      // Display a managed message-box
      System::Windows::Forms::MessageBox::Show("Hello C++/CLI", "TestApp", System::Windows::Forms::MessageBoxButtons::OK);

      return 0;
//=================================== header file (stdafx.h)
// Common include file for Windows Platform SDK

#pragma once

// Minimum requirements
#define WINVER                  0x0400      // Top-level Windows version, common for both Windows 95/98/Me and NT-family
#define _WIN32_WINNT      0x0400      // Windows NT 4.0
#define _WIN32_WINDOWS      0x0410  // Windows 98
#define _WIN32_IE            0x0400      // Internet Explorer 4.0

#define WIN32_LEAN_AND_MEAN            // Exclude rarely-used stuff from Windows headers

// Windows Header Files:
#include <windows.h>
//=====================================Error message during debug

During debug process, it came up with error:-

Error spawning 'cmd.exe'


Build Log
Build started: Project: Hello_CLI, Configuration: Debug|Win32
Command Lines
Creating temporary file "c:\VS2005\CPlusPlus\Hello_CLI\Hello_CLI\Debug\RSP00000330564928.rsp" with contents
/outputresource:"..\debug\Hello_CLI.exe;#1" /manifest
Creating command line "mt.exe @c:\VS2005\CPlusPlus\Hello_CLI\Hello_CLI\Debug\RSP00000330564928.rsp /nologo"
Creating temporary file "c:\VS2005\CPlusPlus\Hello_CLI\Hello_CLI\Debug\BAT00000430564928.bat" with contents
@echo Manifest resource last updated at %TIME% on %DATE% > .\Debug\mt.dep
Creating command line "c:\VS2005\CPlusPlus\Hello_CLI\Hello_CLI\Debug\BAT00000430564928.bat"
Output Window
Embedding manifest...
Project : error PRJ0003 : Error spawning 'cmd.exe'.
Build log was saved at "file://c:\VS2005\CPlusPlus\Hello_CLI\Hello_CLI\Debug\BuildLog.htm"
Hello_CLI - 1 error(s), 0 warning(s)

Now I investigated on internet and could make sense out of it. No lucks

I tried other program and it come with similar error...C++ is not working at all(!).

  • 4
  • 3
1 Solution
Harisha M GCommented:
From Microsoft site:

Setting the environment PATH variable in the control panel to the same value as the one echo %path% produces in the visual studio shell fixes this issue.

So, you need to change the path !!
riscyAuthor Commented:
Please extend this...I not sure I understand this..
riscyAuthor Commented:
On source suggest to do this and it seem to cure the problem but not sure if this is right solution

Project -> "Your project" Properties -> Configuration Properties-> Manifest Tool ->Input and Output -> Embed Manifest = No
The manifest file will be creating.

Please anyone explain to me what happen and why this fix this

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Harisha M GCommented:
Goto Start --> Programs --> Microsoft Visual Studio .. -> Tools --> Visual Studio Command Prompt

Type "path > C:\path.txt" at the command prompt, and then "exit"

Goto Start --> Run and type "cmd.exe"

Type "path < C:\path.txt", and then "exit"
riscyAuthor Commented:
I followed the procedure and it came out

C:\Documents and Settings\Riscy>path<c:\path.txt
PATH=C:\MCC18\mpasm;C:\MCC18\bin;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;C:\Program Files\Common Files\Roxio Shared\DLLShared\;C:\VXIPNP\WINNT\BIN;C:\Program Files\ZipGenius 6\;C:\Program Files\Microsoft SQL Server\90\Tools\binn\;C:\Program Files\Common Files\Adobe\AGL;C:\MCC18\mpasm;C:\MCC18\bin;C\WINDOWS\Microsoft.NET\Framework\v1.1.4322

I then tried again...error still there.

Harisha M GCommented:
OK.. try this:

open C:\path.txt in notepad

Copy everything.

Press Winkey (That exists between Ctrl and Alt) + Pause

Goto Advanced, Environment Variables

Select PATH and click Edit put the copied text, click OK. Do the same for the other list box too.
riscyAuthor Commented:
Okay that fix it...thanks
Would be useful for full explanition or reference material relating to this problem if you have any
The award is your.

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now