Author Topic: Build error "'HEAP_INFORMATION_CLASS' has not been declared"  (Read 4437 times)

yfli

  • Guest
Build error "'HEAP_INFORMATION_CLASS' has not been declared"
« on: March 28, 2014, 12:07:56 am »
Hi all,

I use Code::Blocks 13.12 to build the latest code. The version of wxWidgets is 2.8.12. I always have such compile error:

mingw32-g++.exe -Wall E:\OpenCode\wxWidgets-2.8.12 -pipe -mthreads -fmessage-length=0 -fexceptions -Winvalid-pch -DHAVE_W32API_H -D__WXMSW__ -DWXUSINGDLL -DcbDEBUG -DCB_PRECOMP -DWX_PRECOMP -DwxUSE_UNICODE -DBUILDING_PLUGIN -iquote.objs\include -I.objs\include -I. -IE:\OpenCode\wxWidgets-2.8.12\include -IE:\OpenCode\wxWidgets-2.8.12\lib\gcc_dll\mswu -Isdk\wxscintilla\include -Isdk\wxpropgrid\include -Iinclude\tinyxml -Iinclude -Iinclude\scripting\include -Iinclude\scripting\sqplus -Iinclude\mozilla_chardet -Iinclude\mozilla_chardet\mfbt -Iinclude\mozilla_chardet\nsprpub\pr\include -Iinclude\mozilla_chardet\xpcom -Iinclude\mozilla_chardet\xpcom\base -Iinclude\mozilla_chardet\xpcom\glue -c E:\codeblocksource\codeblocks-head\trunk\src\src\app.cpp -o .objs\src\app.o
E:\codeblocksource\codeblocks-head\trunk\src\src\app.cpp: In function 'void EnableLFH()':
E:\codeblocksource\codeblocks-head\trunk\src\src\app.cpp:788:62: error: 'HEAP_INFORMATION_CLASS' has not been declared
         typedef BOOL  (WINAPI *HeapSetInformation_t)(HANDLE, HEAP_INFORMATION_CLASS, PVOID, SIZE_T);

                                                              ^
E:\codeblocksource\codeblocks-head\trunk\src\src\app.cpp:804:47: error: 'HeapCompatibilityInformation' was not declared in this scope
                 HeapSetInformation_func(h, HeapCompatibilityInformation, &HeapFragValue, sizeof(HeapFragValue));

Thank you in advance.
                                               ^

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7339
    • My Best Post
Re: Build error "'HEAP_INFORMATION_CLASS' has not been declared"
« Reply #1 on: March 28, 2014, 07:43:34 am »
You likely have a broken Compiler or wxWidgets installation or do NOT have WX_PRECOMP defined (but the log you posted has it defined).
Where and How did you do the wxWidgets installation?

It appears to be missing the #include "wx/msw/wrapwin.h" from "wx/wxprec.h" header.
(The wrapwin.h includes windows.h; that includes winnt.h that defines HEAP_INFORMATION_CLASS)

In the app.cpp file try adding the code below between the including <sdk.h> and "app.h".
If it works; likely have wxWidgets issue; if it still fails likely has a bad Compiler.

To confirm compiler try including
#include <windows.h>
or
#include <winnt.h>

Edit 4 or 5: changed __WINDOWS__ to __WXMSW__ in code below.

Code
#include <sdk.h>
#ifndef WX_PRECOMP
    #ifdef __WXMSW__
        #include <wx/msw/wrapwin.h>  // HEAP_INFORMATION_CLASS
    #endif // __WXMSW__
#endif // WX_PRECOMP

#include "app.h"

Tim S.
« Last Edit: March 28, 2014, 08:08:35 am by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 32 bit.
On Debian Stretch, compiling CB Trunk against wxWidgets 3.0.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org