Thread: Newb needs help basic C++ program

  1. #1
    Registered User
    Join Date
    Jun 2010
    Posts
    5

    Newb needs help basic C++ program

    Hey everyone,

    I'm really new to programming and im trying to create a basic "hello world" type of deal. Microsot visual studio winXP here is the code:
    Code:
    #include "stdafx.h"
    #include <stdio.h>
    
    int main()
    {
    	printf("Hello World\n");
    	return 0;
    }
    I get

    1>------ Build started: Project: test.c, Configuration: Debug Win32 ------
    1>Compiling manifest to resources...
    1>Project : error PRJ0003 : Error spawning 'rc.exe'.
    1>Build log was saved at "file://c:\test.c\test.c\Debug\BuildLog.htm"
    1>test.c - 1 error(s), 0 warning(s)
    ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========



    Any idea?

  2. #2
    Programming Ninja In-T...
    Join Date
    May 2009
    Posts
    827
    You need to show what's in the "stdafx.h" header before anyone can help you with your problem.

    Also, if I were you, I would check that Build Log created at:

    c:\test.c\test.c\Debug\BuildLog.htm

    EDIT: Also, it seems you are trying to build a Win32 project, when it probably really should be a console program project instead since all your source file contains is a call to printf and return 0 lines.
    Last edited by Programmer_P; 06-20-2010 at 05:35 PM.
    I'm an alien from another world. Planet Earth is only my vacation home, and I'm not liking it.

  3. #3
    Registered User
    Join Date
    Jun 2010
    Posts
    5
    ok. I created a new file. but same errors.. I REALLY appreciate your reply here we go:

    code:
    Code:
    #include <stdio.h>
    
    int main()
    {
    	printf("Hello World\n");
    	return 0;
    }

    stadfx.h header:

    // stdafx.h : include file for standard system include files,
    // or project specific include files that are used frequently, but
    // are changed infrequently
    //

    #pragma once

    #include "targetver.h"

    #include <stdio.h>
    #include <tchar.h>



    // TODO: reference additional headers your program requires here



    build log:


    Creating temporary file "c:\Documents and Settings\Administrator\My Documents\Visual Studio 2008\Projects\test\testtest\testtest\Debug\RSP0000 0430963336.rsp" with contents
    [
    /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_UNICODE" /D "UNICODE" /Gm /EHsc /RTC1 /MDd /Yu"stdafx.h" /Fp"Debug\testtest.pch" /Fo"Debug\\" /Fd"Debug\vc90.pdb" /W3 /c /ZI /TP ".\testtest.cpp"
    ]
    Creating command line "cl.exe @"c:\Documents and Settings\Administrator\My Documents\Visual Studio 2008\Projects\test\testtest\testtest\Debug\RSP0000 0430963336.rsp" /nologo /errorReportrompt"
    Creating temporary file "c:\Documents and Settings\Administrator\My Documents\Visual Studio 2008\Projects\test\testtest\testtest\Debug\RSP0000 0530963336.rsp" with contents
    [
    /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_UNICODE" /D "UNICODE" /Gm /EHsc /RTC1 /MDd /Yc"stdafx.h" /Fp"Debug\testtest.pch" /Fo"Debug\\" /Fd"Debug\vc90.pdb" /W3 /c /ZI /TP ".\stdafx.cpp"
    ]
    Creating command line "cl.exe @"c:\Documents and Settings\Administrator\My Documents\Visual Studio 2008\Projects\test\testtest\testtest\Debug\RSP0000 0530963336.rsp" /nologo /errorReportrompt"
    Creating temporary file "c:\Documents and Settings\Administrator\My Documents\Visual Studio 2008\Projects\test\testtest\testtest\Debug\TMP0000 0630963336.tmp" with contents
    [
    1 /* CREATEPROCESS_MANIFEST_RESOURCE_ID */ 24 /* RT_MANIFEST */ ".\\Debug\\testtest.exe.embed.manifest"
    ]
    Creating command line "rc.exe /fo".\Debug\testtest.exe.embed.manifest.res" "c:\Documents and Settings\Administrator\My Documents\Visual Studio 2008\Projects\test\testtest\testtest\Debug\TMP0000 0630963336.tmp""
    Creating temporary file "c:\Documents and Settings\Administrator\My Documents\Visual Studio 2008\Projects\test\testtest\testtest\Debug\RSP0000 0730963336.rsp" with contents
    [
    /OUT:"C:\Documents and Settings\Administrator\My Documents\Visual Studio 2008\Projects\test\testtest\Debug\testtest.exe" /INCREMENTAL /MANIFEST /MANIFESTFILE:"Debug\testtest.exe.intermediate.mani fest" /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /DEBUG /PDB:"C:\Documents and Settings\Administrator\My Documents\Visual Studio 2008\Projects\test\testtest\Debug\testtest.pdb" /SUBSYSTEM:CONSOLE /DYNAMICBASE /NXCOMPAT /MACHINE:X86 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib

    ".\Debug\stdafx.obj"

    ".\Debug\testtest.obj"

    ".\Debug\testtest.exe.embed.manifest.res"
    ]
    Creating command line "link.exe @"c:\Documents and Settings\Administrator\My Documents\Visual Studio 2008\Projects\test\testtest\testtest\Debug\RSP0000 0730963336.rsp" /NOLOGO /ERRORREPORT:PROMPT"

    Output Window


    Compiling...
    stdafx.cpp
    Compiling...
    testtest.cpp
    Compiling manifest to resources...
    Project : error PRJ0003 : Error spawning 'rc.exe'.

    Results


    Build log was saved at "file://c:\Documents and Settings\Administrator\My Documents\Visual Studio 2008\Projects\test\testtest\testtest\Debug\BuildLo g.htm"
    testtest - 1 error(s), 0 warning(s)

  4. #4
    Programming Ninja In-T...
    Join Date
    May 2009
    Posts
    827
    Quote Originally Posted by sschargedss View Post
    Output Window


    Compiling...
    stdafx.cpp
    Compiling...
    testtest.cpp
    Compiling manifest to resources...
    Project : error PRJ0003 : Error spawning 'rc.exe'.
    If you removed the #include "stadfx.h" line from your file, then why do you still have the related .cpp file in your project? Remove it from your project, check to make sure your IDE options are set to the right things (can't help you there though, because I've never used VS), then try to compile it again.
    Last edited by Programmer_P; 06-20-2010 at 08:52 PM.
    I'm an alien from another world. Planet Earth is only my vacation home, and I'm not liking it.

  5. #5
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    This has nothing to do with the precompiled header! Leave it alone (stdafx.h/stdafx.cpp).
    Instead, check this link: Project Build Error PRJ0003
    Can you look in the settings to see if the path to the executable is correct?
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  6. #6
    Registered User
    Join Date
    Jun 2010
    Posts
    5
    Quote Originally Posted by Elysia View Post
    This has nothing to do with the precompiled header! Leave it alone (stdafx.h/stdafx.cpp).
    Instead, check this link: Project Build Error PRJ0003
    Can you look in the settings to see if the path to the executable is correct?
    ahh thankyou! (I did do prior searching on the topic) but this helped.
    Got it working now, and the code is running as it should zero errors.

    Thank you programmerp and elysia for taking the time to look into this.


    Totally new to this, and think programmers are sorta bad ass. Thanks for your help again, glad to know there is forums for this

  7. #7
    Registered User
    Join Date
    Dec 2007
    Posts
    2,675
    Why is it not one's first thought, when they get an error they do not understand, to

    1. copy the error
    2. head to their search engine of choice
    3. paste the error
    4. press the search button
    5. review returned links

    Logic and common sense are really important things to possess if you're a programmer, and that process seems...logical and sensible to me. /me shrugs

  8. #8
    Registered User
    Join Date
    Jun 2010
    Posts
    5
    Quote Originally Posted by rags_to_riches View Post
    Why is it not one's first thought, when they get an error they do not understand, to

    1. copy the error
    2. head to their search engine of choice
    3. paste the error
    4. press the search button
    5. review returned links

    Logic and common sense are really important things to possess if you're a programmer, and that process seems...logical and sensible to me. /me shrugs

    you of course did the logical thing and read my post... right? hint (look up one post and read) The problem was the amount of issues people were having and the different resolutions. None of them worked for me. SO logically, I posted a message on a forum. btw thanks for your help...

  9. #9
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Now that you mention it, I see printf in main. Is this supposed to be C++ or C?
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  10. #10
    Registered User
    Join Date
    Jun 2010
    Posts
    5
    Quote Originally Posted by Elysia View Post
    Now that you mention it, I see printf in main. Is this supposed to be C++ or C?
    Its actually C. Not sure what I was thinking posting in C++.

    Out to find a good book on learning C.
    Last edited by sschargedss; 06-23-2010 at 10:56 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Using variables in system()
    By Afro in forum C Programming
    Replies: 8
    Last Post: 07-03-2007, 12:27 PM
  2. newb question: probs with this program
    By ajguerrero in forum C Programming
    Replies: 5
    Last Post: 04-19-2006, 08:04 AM
  3. Problem with basic encryption program.
    By mmongoose in forum C++ Programming
    Replies: 5
    Last Post: 08-27-2005, 04:41 AM
  4. IDEA: A basic drawing program
    By ygfperson in forum Contests Board
    Replies: 0
    Last Post: 08-12-2002, 11:15 PM
  5. Replies: 2
    Last Post: 05-10-2002, 04:16 PM