I have created a sample c++ project under Visual Studio 2010 with following files.
A.h
#ifndef A_H
#define A_H
#include
void foo();
#
First, you need to include "stdafx.h" in your "a.cpp" file before the line for including "a.h".
Second, it is better you add "a.h" into your project "Header Files" and add "a.cpp" into your "Source Files".
Then it will be compiled without error! Good luck.
BTW, the reason to include "stdafx.h" is that by default the project use pre-compiled headers that is why the compiler looks for "stdafx.h".
If you want, you can disable the "precompiled Header" then you don't need "stdafx.h" and everything will be fine.