I am thinking you need to "#include" the "stdafx.h" header file to the dialog class's source/header file.

Code:
// In CFrmMain.h
#include "stdafx.h"

///////////////////////////
/* Other stuff here */
///////////////////////////
Code:
// In CFrmMain.cpp
#include "stdafx.h"

///////////////////////////
/* Other stuff here */
///////////////////////////