Link to home
Start Free TrialLog in
Avatar of riscy
riscy

asked on

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'

//=====================================BuildLog

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
.\Debug\Hello_CLI.exe.intermediate.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'.
Results
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(!).


Avatar of Harisha M G
Harisha M G
Flag of India image

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 !!
Avatar of riscy
riscy

ASKER

Please extend this...I not sure I understand this..
Avatar of riscy

ASKER

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

thanks
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"
Avatar of riscy

ASKER

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.

Riscy
ASKER CERTIFIED SOLUTION
Avatar of Harisha M G
Harisha M G
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of riscy

ASKER

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.