|
-
Jan 24th, 2006, 08:16 PM
#1
Thread Starter
Fanatic Member
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";
}
-
Jan 25th, 2006, 04:47 AM
#2
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.
-
Jan 26th, 2006, 07:11 AM
#3
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.
-
Jan 26th, 2006, 05:42 PM
#4
Thread Starter
Fanatic Member
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
-
Jan 26th, 2006, 06:51 PM
#5
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.
-
Jan 26th, 2006, 09:11 PM
#6
Thread Starter
Fanatic Member
Re: Visual C++ 2005 Home Edition
What is everything I need to run the program.. a header file, .ccp?
-
Jan 26th, 2006, 10:51 PM
#7
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.
-
Jan 27th, 2006, 06:10 PM
#8
Thread Starter
Fanatic Member
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
-
Feb 5th, 2006, 03:18 PM
#9
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
-
Feb 9th, 2006, 10:06 PM
#10
New Member
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.
-
Feb 10th, 2006, 06:23 AM
#11
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.
-
Feb 10th, 2006, 04:54 PM
#12
New Member
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
-
Feb 10th, 2006, 07:36 PM
#13
Lively Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|