Hi Mats,
To me stdafx.h and stdafx.cpp are both empty, can you post yours please?
regards,
George
Printable View
Stdafx.h:
Stdafx.cpp:Code:// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, but
// are changed infrequently
//
#pragma once
// Modify the following defines if you have to target a platform prior to the ones specified below.
// Refer to MSDN for the latest info on corresponding values for different platforms.
#ifndef WINVER // Allow use of features specific to Windows XP or later.
#define WINVER 0x0501 // Change this to the appropriate value to target other versions of Windows.
#endif
#ifndef _WIN32_WINNT // Allow use of features specific to Windows XP or later.
#define _WIN32_WINNT 0x0501 // Change this to the appropriate value to target other versions of Windows.
#endif
#ifndef _WIN32_WINDOWS // Allow use of features specific to Windows 98 or later.
#define _WIN32_WINDOWS 0x0410 // Change this to the appropriate value to target Windows Me or later.
#endif
#ifndef _WIN32_IE // Allow use of features specific to IE 6.0 or later.
#define _WIN32_IE 0x0600 // Change this to the appropriate value to target other versions of IE.
#endif
#define _HAS_TR1 1
#include <stdio.h>
#include <tchar.h>
#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit
#ifndef VC_EXTRALEAN
#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
#endif
#include <afx.h>
#include <afxwin.h> // MFC core and standard components
#include <afxext.h> // MFC extensions
#ifndef _AFX_NO_OLE_SUPPORT
#include <afxdtctl.h> // MFC support for Internet Explorer 4 Common Controls
#endif
#ifndef _AFX_NO_AFXCMN_SUPPORT
#include <afxcmn.h> // MFC support for Windows Common Controls
#endif // _AFX_NO_AFXCMN_SUPPORT
#include <afxmt.h>
#include <vector>
#include <map>
#include <fstream>
#include <iostream>
#include <cstdlib>
#include <iomanip>
#include <ctime>
#include <cmath>
#include <string>
#include <list>
#include <string>
#include <new>
//#include <stdint.h>
#include <sstream>
#include <Stuff\Requirements.h>
// TODO: reference additional headers your program requires here
Far from empty if you ask me.Code:// stdafx.cpp : source file that includes just the standard includes
// Help.pch will be the pre-compiled header
// stdafx.obj will contain the pre-compiled type information
#include "stdafx.h"
// TODO: reference any additional headers you need in STDAFX.H
// and not in this file
Considering I work with an embedded compiler that is NOT Microsoft compatible, the answer is no.
In my hobby projects, I don't use precompiled headers for the very reason that I want to have all the includes needed for the project clearly visible in the C(++)-file, and not hidden inside some other file.
If both stdafx.cpp and stdafx.h are empty, then precompiled headers make absolutely no sense at all.
--
Mats
Thanks Mats,
Why using pre-compiled header file will make code not convenient to read? I think even if we use /Yu in compile option, when reading code, the inlcude files are still in the source file, using /Yu or not only impact compiler's optimization, there is no code change in source file, why do you think using pre-compiled header file will make code not clear to read?
Thanks Mats,
"turn off" you mean turn off pre-compiled header creation (/Yc) or turn off pre-compiled header using (/Yu)?
Thanks Elysia,
This conflicts with CornedBes's point in post #13, where he said the stdafx.h is empty. Any comments?
(BTW: I did search for stdafx.h and stdafx.cpp in my VC folder, and some of them are empty and some of them are not.)
Thanks CornedBee,
I think whether or not pre-compiled header is used is decided by the compiler option /Yu, why do you think it is decided by whether the related header file is empty or not -- "the compiler sees the include of the empty stdafx.h as a directive to use stdafx.pch"
regards,
George