KindDragon / vld

Visual Leak Detector for Visual C++ 2008-2015
https://kinddragon.github.io/vld/
GNU Lesser General Public License v2.1
1.01k stars 314 forks source link

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

Open CedricCicada opened 3 years ago

CedricCicada commented 3 years ago

The vld.h file contains this:

`#ifdef __AFXWIN_H__

error[VLD COMPILE ERROR] '#include ' should appear before '#include ' 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.

RoyalPictou commented 3 years ago

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.

CedricCicada commented 3 years ago

I agree completely.  I never use them.  But there may still be places where afxwin.h gets included that I don't know about.  Either the documentation or the program still needs to be fixed. On Wednesday, February 3, 2021, 06:28:33 PM EST, RoyalPictou notifications@github.com wrote:

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 increase compile times.

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

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

pgerell commented 3 years ago

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.