Thread: error PRJ0003 : Error spawning 'cmd.exe'.

  1. #1
    Registered User
    Join Date
    Dec 2008
    Posts
    10

    error PRJ0003 : Error spawning 'cmd.exe'.

    Hi im getting this error :


    1>------ Build started: Project: lesson1, Configuration: Debug Win32 ------
    1>Compiling...
    1>main.cpp
    1>Linking...
    1>Embedding manifest...
    1>Project : error PRJ0003 : Error spawning 'cmd.exe'.
    1>Build log was saved at "file://c:\Users\Hung Do\Documents\Visual Studio 2008\Projects\lesson1\lesson1\Debug\BuildLog.htm"
    1>lesson1 - 1 error(s), 0 warning(s)
    ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========


    i have no idea what is wrong. this is also my first time programming in C++. i'm using Visual c++ 2008 express edition.

  2. #2
    Registered User
    Join Date
    Dec 2008
    Posts
    9
    Looks like windows has stuffed up, aside from telling you to program in Linux with VIM - i would say to ctrl+alt+del end your cmd.exe process. If that doesn't work reset.

    Other wise it is a problem with VS - its trying to run your code output in a command prompt but cant open it.

  3. #3
    Registered User
    Join Date
    Dec 2008
    Posts
    10

    still a problem

    still the same problem... in reset do u mean restart the computer?

  4. #4
    Registered User
    Join Date
    Dec 2008
    Posts
    9
    yes reset.

    if that doesnt work post your code (in code tags) then at least we can verify if it is a windows error, or a developer error :P

    ~ Dan

  5. #5
    Registered User
    Join Date
    Dec 2008
    Posts
    10

    here u go

    Code:
    #include <iostream>
    
    int main(){
    	std::cout << "hello world!" <<std ::endl;
    	return EXIT_SUCCESS;
    }
    im pretty sure this is right. i am restarting to make sure.

  6. #6
    Registered User
    Join Date
    Dec 2008
    Posts
    10
    nothing worked still an error...

  7. #7
    Registered User
    Join Date
    Dec 2008
    Posts
    9
    Code:
    #include <iostream>
    
    int main(){
    	std::cout << "hello world!" <<std ::endl;
    	return EXIT_SUCCESS;
    }
    std::endl; is there a space there?

    have you defined EXIT_SUCCESS? EXIT_SUCCESS is a macro which would be in a header file somewhere (which you are not including using #include)

    Although it is wierd because you code shouldnt compile or build if it is wrong. It looks like visual studio us stuffing up. if fixing the code doesnt work, reinstall VS or rever to VS2005

  8. #8
    Registered User
    Join Date
    Dec 2008
    Posts
    10

    thx

    aight thx

  9. #9
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    Quote Originally Posted by zigga15
    std::endl; is there a space there?
    Whitespace is not significant at that point, though it is convention not to have whitespace there.

    Quote Originally Posted by zigga15
    have you defined EXIT_SUCCESS? EXIT_SUCCESS is a macro which would be in a header file somewhere (which you are not including using #include)

    Although it is wierd because you code shouldnt compile or build if it is wrong.
    EXIT_SUCCESS is from <cstdlib> which in turn could be included via <iostream>, or perhaps through a header included by <iostream>. It is true that it would be better to explicitly #include <cstdlib>, but then just returning 0 would be the simplest option.

    Quote Originally Posted by zigga15
    It looks like visual studio us stuffing up. if fixing the code doesnt work, reinstall VS or rever to VS2005
    Before doing that, read the MSDN documentation on Project Build Error PRJ0003.
    Last edited by laserlight; 12-21-2008 at 11:50 PM.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  10. #10
    Registered User
    Join Date
    Dec 2008
    Posts
    10

    idea

    i think it is a path issue how would i do that?

    i know as for as going to environment variables and editing a path but i dont know what path to set and to what file i am setting it to.

  11. #11
    Registered User
    Join Date
    Dec 2008
    Posts
    9
    seems like a windows error to me :P

    The simplest way to see if it is cmd.exe or the path to cmd.exe is to write a program that does this:

    Code:
    int main () {
        //nothing
        return 0;
    }
    You should see the cmd.exe prompt flash on the screen. If that doesn't work then it is probs a path problem with CMD. If it does work its a problem with your code/includes

  12. #12
    Registered User
    Join Date
    Dec 2008
    Posts
    10

    ok

    ok i tried that and the problem is with the CMD it is probably because i have Vista how would i fix it from there?

  13. #13
    Registered User
    Join Date
    Dec 2008
    Posts
    9
    Install Linux - or even windows XP :P

    cmd.exe is in the system32 directory, if you can run cmd (start->run->cmd.exe) you probably have a problem with VS linking to it. if you cant run it from start then you have a problem with cmd itself

    You could maybe change it manually through the settings, it will be something like: path to command or path to terminal. Or you can just reinstall VS so that it can relink with cmd.exe

    If you have HDDs named differently - knowing how lazy micro$oft programmers are they probably just have CONSOLE="C:\System32\cmd.exe" --- LOL, make sure it is in the right directory just in case :P

  14. #14
    Registered User
    Join Date
    Dec 2008
    Posts
    10

    ok

    i dual boot linux but i dont know how to use it : /

    cmd.exe works. i reinstalled VS already and same outcome. and i put in my User variables

    PATH: C:\Windows\System32\cmd.exe...and still same outcome

    dam microsoft didnt know i had to go thought this much trouble to write a hello world program...

  15. #15
    Registered User
    Join Date
    Dec 2008
    Posts
    10
    ok i somehow got it working

    when u first start building the program using ctrl+F5 a window comes up saying what u are building then after that there is a window that says "do you want to use the previous working build" i said yes and it worked. last time i said no... but still it was my first time using it so there would be no previous build... dam u microsoft

    o and i still get the error but it works : P
    Last edited by hung555; 12-22-2008 at 01:07 AM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Communication with cmd.exe
    By Livijn in forum C++ Programming
    Replies: 16
    Last Post: 03-31-2007, 09:14 AM
  2. Unrestrict cmd.exe for normal users in XP
    By civix in forum Tech Board
    Replies: 4
    Last Post: 12-04-2006, 05:45 PM
  3. executing cmd.exe commands?
    By Dragoon_42 in forum C++ Programming
    Replies: 3
    Last Post: 11-03-2005, 12:22 PM
  4. cmd.exe
    By cnoob in forum C++ Programming
    Replies: 1
    Last Post: 06-08-2005, 12:23 PM
  5. Encapsulating cmd.exe
    By bennyandthejets in forum Windows Programming
    Replies: 4
    Last Post: 05-17-2005, 12:46 AM