Hi There

I used to develop C programming some 5 years back using Visual Studio. Now I am on my way to develop C++ using Visual Studio .Net 2003.

I started of to create new project, there are numbers of different type to choose (Win32 Console Project, Console Application (.Net), Windows Forms Application (.Net)). So, I just tried eash of them. Then I tried out this code:

#include <iostream>

using namespace std;

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

Somehow, none of those project recognize the code, I get this error.

d:\C Language\First In C\Win32\Win32.cpp(13): fatal error C1010: unexpected end of file while looking for precompiled header directive

Maybe I shd get clear each of those project. Anyone can provide me some guide would be much appreciated.

Thanks.

>>Now I am on my way to develop C++ using Visual Studio .Net 2003.
Bad idea. Upgrade to VC++ 2008. The Express edition is free for the downloading.


>>Somehow, none of those project recognize the code, I get this error
VC++ uses precompiled headers and the very first include file needs to be stdafx.h

#include "stdafx.h"
// other code here

You can turn off precompiled headers, but I don't know how with VC++ 2003.

you created a project that requires a precompiled header. So: #include "stdafx.h" and the problem is solved.
Why are you using 2003 btw? You can download 2008 for free

[edit] Brilliant minds think alike ;) Only mine works slower then Ancient Dragon's.
Just kidding ofcourse

Hi

Thanks guy. I had downloaded the latest version of 2008 and had it go. I tried out a simple one, but hit "cout undeclared identifier".

#include "stdafx.h"


int _tmain(int argc, _TCHAR* argv[])
{
	cout << "hello, there" << endl;
	return 0;
}

Isnt this the most basic one??
Where went wrong?

I am true beginner in C++.

Pls help.

you'll have to #include <iostream> And don't forget that 'cout' is in the 'std' namespace. So add using namespace std; just above your main, or use std::cout and std::endl

Thanks. I missed out the 'std' namespace.

Cheers.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.