# Testing my first "Hello World" in VSC++

This topic is 4488 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hi! I'm as fresh I can be at programming, so well. I started with a tutorial and tested the Hello World code, but when I was going to debug it in "Visual Studio C++ 2003 .Net" it got an error, that I dont remember what it said... Anyway, I cleaned up my "Visual Studio Project" folder and restarted with a new .cpp project, and tried again. But now I cant press the debug button somehow, its inactive. What should I do? Hope somebody can push this noobie in the right direction, so I can deal with the rest. Thank you! // PriMo Here is the code by the way(directly copied from the tutorial, so there should be no errors):
#include <iostream>

using namespace std;

int main()
{
cout<<"HEY, you, I'm alive! Oh, and Hello World!\n";
cin.get();

return 1;
}

##### Share on other sites
I don't know how to use VSC++ .net anyway, try compiling the program and see if the debug turns on.

##### Share on other sites
You have not provided any information that could be used to help you.

CM

##### Share on other sites
Press F5, if it ask if you want to compile answer yes.

Lizard

##### Share on other sites
Nothing happens when I press F5, just because its inactive.

If you can not tell me how to fix this problem, then is there like a special setup you got to do before starting programming?

Ok, now I tried with starting a new "win32 console project" instead of a .ccp file.
So now i can debug but this is the error that come up:

c:\Documents and Settings\PriMo\My Documents\Visual Studio Projects\hello\hello.cpp(12): fatal error C1010: unexpected end of file while looking for precompiled header directive

Anybody have a clue?

##### Share on other sites
If you are just trying to do a 'Hello World' program, you might want to start by using a Win32 Console project and then add your hello.cpp file to it. The error you are getting looks like it is related to some resource file dependencies or stdfx.h (Windows specific).

If you are still having trouble, I'll send you a simple workspace if you like.

Will

##### Share on other sites
#include "stdafx.h"

Or something like that (not sure I got the name exactly right). Either this, or you could turn off precompiled headers.

This is usually #included automatically when you create a new project.

##### Share on other sites
Quote:
 Original post by PriMo222c:\Documents and Settings\PriMo\My Documents\Visual Studio Projects\hello\hello.cpp(12): fatal error C1010: unexpected end of file while looking for precompiled header directiveAnybody have a clue?

Now we're getting somewhere.

If you have your project setup to use precompiled headers [which is the default state], the first line of every source file has to be #include "stdafx.h". Just add that line and see if it takes care of the problem. If not, you can turn off precompiled headers by going to Project->Properties->C/C++->Precompiled Headers.

CM

##### Share on other sites
File->New->Project
Select Visual C++ Projects on the left, Win32 Console Project on the right.
Type a project name, choose a directory, and hit OK.

A wizard will come up. DO NOT PRESS FINISH. On the left, click Application Settings. Check the Empty Project checkbox. Now press Finish.

On the right, click "C++ File (.cpp)". Type the name of your new file and click Open.

Now type in your code. F7 compiles, F5 compiles if needed and then runs in debugger (recommended), Ctrl-F5 compiles if needed and then runs without debugger (a little faster).

~BenDilts( void );

##### Share on other sites
aah, finally.
Thank you all very much. Now I can finally continue and hopefully get longer then the first page of the tutorial. ^^

Thanks again!
//
PriMo

##### Share on other sites
Quote:
 Original post by BeanDogFile->New->ProjectSelect Visual C++ Projects on the left, Win32 Console Project on the right.Type a project name, choose a directory, and hit OK.A wizard will come up. DO NOT PRESS FINISH. On the left, click Application Settings. Check the Empty Project checkbox. Now press Finish.

At this point, there's a setting to not use precompiled headers, but its greyed out so you can't turn it off. Annoys me to no end.

CM

##### Share on other sites
If you check empty project there won't be any precompiled headers.

##### Share on other sites
Quote:
 Original post by EriondIf you check empty project there won't be any precompiled headers.

Well I'll be damned, you're right. I just sort of assumed 'empty project' didn't change anything except what files it generates automatically.

CM