KindDragon/vld

Documentation says #include vld.h must be after stdafx.h, but fatal error is thrown if I do

CedricCicada opened this issue · 3 comments

The vld.h file contains this:

#ifdef __AFXWIN_H__ #error[VLD COMPILE ERROR] '#include <vld.h>' should appear before '#include <afxwin.h>' in file stdafx.h #endif

But the documentation says this:

"In at least one C/C++ source file from your program, include the vld.h header file. It should not matter which file you add the include statement to. It also should not matter in what order the header is included in relation to other headers. The only exception is stdafx.h (or any other precompiled header). A precompiled header, such as stdafx.h, must always be the first header included in a source file, so vld.h must be included after any precompiled headers."

Please fix one or the other.

To me, using precompiled headers is a mess. I omit them where I can as they lead to many errors, faults, mistakes and - it's OLD technology from Microsoft, which has helped in recent times to decrease compile times.

Eliminate it completly, if possible ... just a tip.

I have positive experiences from using precompiled headers. Reduces compile times a lot.
A long time ago they could be problematic. These days a correctly defined precompiled header rarely introduce any problem.

Note that afxwin.h has nothing to do with precompiled headers.
Likewise, stdafx.h has nothing to do with AFX (MFC). It's just the default name used by wizards in old versions of Visual Studio. Recent versions use the name pch.h instead.

There should be no conflict between precompiled headers and VLD in the same project.
Just make sure the precompiled header does not include afxwin.h.