Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

"Hello, World" Problem..

Status
Not open for further replies.
May 14, 2005
6
US
I having a problem created the Hello, World project but unfortunately it doesnt work. I typed exactly what was in the book but it keeps saying 1 Error, 0 Warnings. This is what I put:
// a small C++ program
#include <iostream>

int main()
{
std::cout << "Hello, World!" << std::end1;
return 0;
}
and this is what it says at the bottom after it says Compiling...blah blah:
c:\program files\microsoft visual studio\myprojects\hello world project\hello world project.cpp(11) : fatal error C1010: unexpected end of file while looking for precompiled header directive
Error executing cl.exe.

Hello World Project.exe - 1 error(s), 0 warning(s)

Also if you want to make a program like this which type of thing do you use when you click New in the File tab? Theres like W32 and a bunch of other stuff...Some one please help!

Also, im new to the forums so Im not sure if im breaking any rules or anything..
 
Sounds like you used an inappropriate project type. When you create a simple application like this, you want to make a Console Project.

The type of file you created is a C++ Source File.
 
> unexpected end of file while looking for precompiled header directive
Project->Settings->Compiler (or thereabouts)

Look for an option which talks about precompiled headers, and turn it OFF.


Or start with a new win32 console project which will automatically create a new source file which is "precompile header" friendly. Then paste your single line of code into that.



--
 
Some one mind helping me with this problem? This is supposed to be like the easiest simple program.
 
I did that but now it says:
c:\program files\microsoft visual studio\myprojects\hello world project\hello world.cpp(6) : error C2039: 'end1' : is not a member of 'std'
c:\program files\microsoft visual studio\myprojects\hello world project\hello world.cpp(6) : error C2065: 'end1' : undeclared identifier
Error executing cl.exe.

Hello World Project.exe - 2 error(s), 0 warning(s)

 
it's endl (lowercase L), not end1 :) (as in "end of line")
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top