Using Microsoft C++ Express thing

I'm trying that out, to see f I can use that instead of code::blocks, and I get this error when I try and compile simple "Hello world!"
"Add directive to 'StdAfx.h' or rebuild precompiled header"
So, heres my code
1
2
3
4
5
6
7
8
9
10
11
12
13
// Porject 1.cpp : Defines the entry point for the console application.
//

#include <iostream>
#include "StdAfx.h"
using namespace std;


int main()
{
	cout << "Hello World!";
	return 0;
}
I've found that the '#include <stdafx.h>' must be first. Try switching the two includes around, and it should compile and run run just fine.
Do the following steps so that you don't have to #include "stdafx.h" :

1. Open your project's properties

2. Go to Configuration Properties -> C/C++ -> Precompiled Headers

3. Change the option "Create/Use Precompiled Header" to "Not Using Precompiled Headers"

4. Click Apply. Close the project properties, and the next compile should succeed (maybe do a full rebuild to be safe).

Also, see http://en.wikipedia.org/wiki/Precompiled_header ("stdafx.h" is described under Common Implementations)
Thank you. Both of you're things worked.
Topic archived. No new replies allowed.