기본 콘텐츠로 건너뛰기

Fixing the "Error spawning cmd.exe" Error in Visual Studio

When trying to build a C++ project with Visual Studio 2005 Beta 2(or 2007, 2008), I always get a PRJ0003 error:Error spawning 'cmd.exe'
Since I mostly use C# this hasn't been bothering me unduly, particularly since it mainly seems to afflict a custom build action that doesn't appear to be essential for the compilation process... But I finally got around to finding a solution.
The first clue was that if I invoked VCBuild.exe from the command line, I could get rid of the problem by using the /useenv command line option. This tells it to use environment variables to get the path to libraries, executable and the like instead of using the configured directories. The fact that it works when using the environment variables, but not when using the configured directories pointed the finger at the configured directories...
This config can be found in Visual Studio's Options dialog (off the Tools menu). It's in the Projects and Solutions -> VC++ Directories page. This turns out to configure settings used both by VS and also by the command-line VCBuild. (I think VS just launches VCBuild to build your project.)
This options page has a row of buttons on the right hand side. One of these is a tick. Clicking that checks all of the configured items for validity. When I clicked this, it complained about three items:%SystemRoot%\System32
%SystemRoot%
%SystemRoot%\System32\wbem
Those entries look out of place. They're using the %xxx% variable syntax you can use from the command line. But all the other entries use the $(xxx) convention. So I changed the entries to:$(SystemRoot)\System32
$(SystemRoot)
$(SystemRoot)\System32\wbem
I clicked the tick button again, and this time it was happy. And now when I build C++ projects (either from the command line or VS) I no longer get the Error spawning 'cmd.exe' error.

댓글

이 블로그의 인기 게시물

Ubuntu (Kubuntu) 에 desktop 파일 만들기

Package 관리자등을 통해 직접 Repository 에 있는 Application 을 설치하는 경우에는 필요한 경로와 파일, Category 로 분류된 Icon 등록 등이 자동적으로 이루어지나 firefox, eclipse 등 새로운 버전을 새로 설치할 경우, 다음과 같은 절차를 통해 시작메뉴에 등록시킬 수 있다. 다음은 eclipse-SDK-3.6-linuxx-gtk.tar.gz 을 받아 설치 등록하는 것을 예로 든다. 1. 다운받은 파일을 /usr/lib에 압축해제한다. (물론, super user 계정으로 실행해야 한다.) 2. 보통의 경우, /usr/bin Directory 는 PATH 에 물려 있으므로 다음과 같은 실행 파일을 만들어 놓는다. # cd /usr/lib # chmod +x eclipse # cd /usr/bin # sudo nano eclipse eclipse 파일에는 아래의 내용을 입력하여 넣는다. export ECLIPSE_HOME="/usr/lib/eclipse" $ECLIPSE_HOME/eclipse $ * # sudo chmod 755 eclipse 3. Desktop Menu 에 추가하려면 # cd /usr/share/applications # sudo nano eclipse.desktop [Desktop Entry] Encoding=UTF-8 Name=Eclipse Comment=Eclipse IDE Exec=eclipse Icon=/usr/lib/eclipse/icon.xpm Terminal=false Type=Application Categories=GNOME;Application;Development' StartupNotify=true 이렇게 입력한 파일을 저장하면, 시작메뉴 > 개발 > Eclipse 아이콘이 생성되어 메뉴에서 직접 실행할 수 있게된다.

VC++(MFC)에서 ADO와 ADOX를 이용한 MDB 파일 생성 / 연동 / 압축에 관한 모든 것

VC++(MFC)에서 MDB 생성 / 압축 / 연동 □ 개 요 ○ Access로 생성하는 DB 파일인 MDB 파일의 생성과 압축 및 기본 DB연동(데이터의 추가, 삭제, 검색, 수정)에 대한 내용 ○ 다이얼로그 기반의 MFC 프로젝트 상에서 위의 작업들을 수행하는 CDataBase라는 사용자 정의 클래스를 만들고 구현 □ 준비 작업 ○ stdafx.h에 다음을 import 한다. /* DB 사용을 위한 설정*/ #import "C:\Program Files\Common Files\System\ADO\msado15.dll" rename("EOF", "EndOfFile") /* DB 파일 압축을 위한 설정*/ #import "C:\Program Files\Common Files\System\ado\msjro.dll" no_namespace /* DB 파일 생성을 위한 설정*/ #import "c:\Program Files\Common Files\system\ado\msadox.dll" using namespace ADODB; using namespace ADOX; ※ ADO(msado15.dll) 자체에서는 DB 파일 생성과 압축에 대한 라이브러리가 없기 때문에 각각에 필요한 DLL 파일을 Import 해야 한다. 하지만 ADOX(msadox.dll)와 단순히 같이 Import하면 충돌하기 때문에 서로 namespace를 지정해 준다. 또한 인터넷에 돌아다니는 일부 코드는 msadox.dll를 Import할 때 rename 혹은 no_namespace 옵션을 주곤 하는데 이를 위와 같이 해제한다. ○ 초기화 작업을 수행한다. => 프로젝트의 메인파일 (TestDlg.cpp)의 BOOL CTestDlgAPP::InitInstance()에 다음 내용을 추가 /* Ole 컨트롤의 지원을 위한 작업을 가능하게 함*/ AfxEnableControlContainer(); if (!...

VIDEO_DXGKRNL_FATAL_ERROR on Windows 8.1

Windows 8.1 로 업데이트 이후, Booting 시 Blue Screen 이 뜨면서, VIDEO_DXGKRNL_FATAL_ERROR 또는 SYSTEM_SERVICE_EXCEPTION (atikmpag.sys)  가 발생하는 문제점이 있을 때, 아래와 같이 조치해 보십시오. 제어판 -> 전원 옵션 -> 설정 변경 덮개를 닫으면 수행되는 작업 선택 -> 현재 사용할 수 없는 설정 변경 -> 종료 설정 -> 빠른 시작 켜기(권장)의 Check Box 를 해제함.