Ive seem some sources for Win32 projects that include one of the following lines:
#define WIN32_LEAN_AND_MEAN
#define _WIN32_IE >= 0x0300
#define _WIN32_IE 0x0400
#define _WIN32_IE 0x0600
Can you tell me what are they for and when to use them?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
lean and mean leaves out a bunch of rarely needed headers when compiling.. speeds things up.
the WIN32_IE ones are to tell the compiler which version of Internet Explorer to compile for, depending on which you put it will leave out things that aren't supported by that version, for instance if you put 0x0300 it won't include the stuff for common dialogs.
balckadder
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
generally speaking:
with #define you may influence the behavior of your compiler.
/* avoid MFC in existing Programs and compiler differences */
#define CString string
#define ASSERT assert
#define TRACE0 _mylog
many Preprocessor variables are used by the "system".
And if you have a error in " neverseen.h" mostly a define is wrong :-) maybe "windows.h" is missing or compilerflag not set.
Sometimes it might be useful, to use Flags if you need a conditonal compilation, for debugging options and so on. So you can avoid, that all DLL's have to be loaded during execution and so on.
like:
the variables you can influence with compiler-input
as -D_myGUI ( link GTK+ to application)
As you see it's quit tricky.
I hope you got a idee about #define
in C++ you should prefer things like templates and inheritance, and keep defines to a minimum.
Patrick
Look at the example of a header.file,
avoid multiple call during compiletime, handling of c and C++ differences...very nice an maintainable code ;-)
#ifndef infra_h
#define infra_h
// -------------------
// example
/* os-versions */
#ifdef unixsolaris
#include special_includes.h
#elifdef hp_unix
#endif /* unix os */
/* debugging */
#ifdef _debug
#include debug.h
#endif
/* GUI
#ifdndef _NOGUI
#include <gtk.h> /* and so on */
#endif
#endif /* infra_h */
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Ive seem some sources for Win32 projects that include one of the following lines:
#define WIN32_LEAN_AND_MEAN
#define _WIN32_IE >= 0x0300
#define _WIN32_IE 0x0400
#define _WIN32_IE 0x0600
Can you tell me what are they for and when to use them?
Lean and mean means "good".
lean and mean leaves out a bunch of rarely needed headers when compiling.. speeds things up.
the WIN32_IE ones are to tell the compiler which version of Internet Explorer to compile for, depending on which you put it will leave out things that aren't supported by that version, for instance if you put 0x0300 it won't include the stuff for common dialogs.
balckadder
generally speaking:
with #define you may influence the behavior of your compiler.
/* avoid MFC in existing Programs and compiler differences */
#define CString string
#define ASSERT assert
#define TRACE0 _mylog
many Preprocessor variables are used by the "system".
And if you have a error in " neverseen.h" mostly a define is wrong :-) maybe "windows.h" is missing or compilerflag not set.
Sometimes it might be useful, to use Flags if you need a conditonal compilation, for debugging options and so on. So you can avoid, that all DLL's have to be loaded during execution and so on.
like:
the variables you can influence with compiler-input
as -D_myGUI ( link GTK+ to application)
As you see it's quit tricky.
I hope you got a idee about #define
in C++ you should prefer things like templates and inheritance, and keep defines to a minimum.
Patrick
Look at the example of a header.file,
avoid multiple call during compiletime, handling of c and C++ differences...very nice an maintainable code ;-)
#ifndef infra_h
#define infra_h
// -------------------
// example
/* os-versions */
#ifdef unixsolaris
#include special_includes.h
#elifdef hp_unix
#endif /* unix os */
/* debugging */
#ifdef _debug
#include debug.h
#endif
/* GUI
#ifdndef _NOGUI
#include <gtk.h> /* and so on */
#endif
#endif /* infra_h */