Results 1 to 13 of 13

Thread: Visual C++ 2005 Home Edition

  1. #1

    Thread Starter
    Fanatic Member paralinx's Avatar
    Join Date
    Jun 2005
    Location
    Michigan
    Posts
    987

    Visual C++ 2005 Home Edition

    Hi all,

    I am absolutely new to C++ so I downloaded Visual C++ 2005 Express Edition. And all of the tutorials I have found on the internet do not have the same GUI as this C++ edition, so I was wondering if I downloaded the right C++? I also tried running code snippets from the tutorials and it will give me build errors. I tried

    Code:
    #include "stdafx.h"
    
    
    int _tmain(int argc, _TCHAR* argv[])
    {
    	cout<<"Hello World\n";
    }

  2. #2
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: Visual C++ 2005 Home Edition

    To use cout you need to include the iostream header, which contains those functions. cout lives in the std namespace so you can either use std::cout or import the namespace.

    Code:
    #include <iostream>
    
    int main()
    {
        std::cout << "Hello World!\n";
    }
    Or
    Code:
    #include <iostream>
    
    using namespace std;
    
    int main()
    {
        cout << "Hello World!\n";
    }
    Note that instead of \n you can use std::endl (end line) which is a stream manipulator, as follows:
    Code:
    std::cout << "Hello World!" << std::endl;
    Last edited by penagate; Jan 25th, 2006 at 04:55 AM.

  3. #3
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594

    Re: Visual C++ 2005 Home Edition

    And make sure you select "Empty Project" in the project wizard, or you'll get weird errors.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  4. #4

    Thread Starter
    Fanatic Member paralinx's Avatar
    Join Date
    Jun 2005
    Location
    Michigan
    Posts
    987

    Re: Visual C++ 2005 Home Edition

    Ok, so when I try to run the below code in an empty project it will say

    "Unable to start program 'C:Learning Project.exe'
    The system cannot find the specified file
    Code:
    #include <iostream>
    
    using namespace std;
    
    int main()
    {
        cout << "Hello World!\n";
    
    }
    Now remember, I am completely new to C++ so I don't know whats goin on

  5. #5
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594

    Re: Visual C++ 2005 Home Edition

    I'd say you have some project configuration problems. It's attempting to launch a file that most definitely doesn't exist. Can't remotely solve that, though. Sorry.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  6. #6

    Thread Starter
    Fanatic Member paralinx's Avatar
    Join Date
    Jun 2005
    Location
    Michigan
    Posts
    987

    Re: Visual C++ 2005 Home Edition

    What is everything I need to run the program.. a header file, .ccp?

  7. #7
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: Visual C++ 2005 Home Edition

    Dont even need a header file. If you start with an empty project there should be nothing. Just add one .cpp source file, dump that code in, hit build and run. If that doesn't work, you definetely have some weird issue. try building it to different locations, see if that makes any difference.

  8. #8

    Thread Starter
    Fanatic Member paralinx's Avatar
    Join Date
    Jun 2005
    Location
    Michigan
    Posts
    987

    Re: Visual C++ 2005 Home Edition

    When I try to build, it says 0 succeeded and 1 up-to-date... but when i click on "start debugging" then it says the same error

  9. #9
    Frenzied Member conipto's Avatar
    Join Date
    Jun 2005
    Location
    Chicago
    Posts
    1,175

    Re: Visual C++ 2005 Home Edition

    Try this:

    New project.. Win32 Console App

    The wizard comes up, click Application settings...

    Check Empty Project..

    Check Finish

    Go to the solution explorer on the right..

    Right click on Code.. Add.. New Item

    Pick C++ File (.cpp) from the code section of the tree. Call it whatever you want (main.cpp is usually appropriate)

    Then, you can start using some of the examples posted above.

    P.S. - For learning and whatnot, if you're running it in the IDE, It's often helpful to add the line system("pause"); to the end of the program, so it doesn't flash on screen then go away.

    Bill
    Hate Adobe Acrobat? My Codebank Sumbissions - Easy CodeDom Expression evaluator: (VB / C# ) -- C# Scrolling Text Display

    I Like to code when drunk. Don't say you weren't warned.

  10. #10
    New Member
    Join Date
    Feb 2006
    Posts
    5

    Re: Visual C++ 2005 Home Edition

    I think that you should leave in:

    #include "stdafx.h"

    then type:

    #include <iostream>

    int main()
    {
    cout << "Hello World!";
    return 0;
    }

    I think that the line "#include "stdafx.h" has something to do with including essential files necessary to code in the VC++ environment. Try that and let me know what happens.

  11. #11
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594

    Re: Visual C++ 2005 Home Edition

    Wrong. There are no "essential files necessary to code in the VC++ environment".

    It's a project setting that Empty Project avoids that makes stdafx.h necessary. Which is why I always tell people to create empty projects.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  12. #12
    New Member cilu's Avatar
    Join Date
    Jan 2006
    Location
    Timisoara, Romania
    Posts
    7

    Re: Visual C++ 2005 Home Edition

    And all of the tutorials I have found on the internet do not have the same GUI as this C++ edition, so I was wondering if I downloaded the right C++?
    The best comparison of the major VS 2005 editions can be found at this locations: http://msdn2.microsoft.com/en-us/library/hs24szh9.aspx
    CodeGuru Moderator & Article Reviewer

    Differences of habit and language are nothing at all if our aims are identical and our hearts are open. - J.K. Rowling, HP and the Goblet of Fire

  13. #13
    Lively Member
    Join Date
    Sep 2005
    Posts
    69

    Question Re: Visual C++ 2005 Home Edition

    What type of C++ are you trying to put in to the 2005 compiler? I'm sure that 2005 is based around .NET. Are you using VC++ 6 or ANSI C++ at all?

    i also thought i saw a hello world above. have you tried using these examples

    VC++6

    //Hello World Example
    #include<iostream.h>
    using namespacestd;
    int main()
    {
    cout<<"Hello World!" << endl;
    return 0;
    }

    VC++.NET

    #include "stdafx.h"

    #using <mscorlib.dll>
    #include <tchar.h>

    using namespace system;

    int_tmai(void)
    {
    Console::Writeline(S"hello world!");
    return 0;
    }
    Last edited by VB4Eva; Feb 10th, 2006 at 07:44 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width