Author Topic: Error while building codeblocks src code  (Read 883 times)

Offline anandamu16

  • Multiple posting newcomer
  • *
  • Posts: 97
Error while building codeblocks src code
« on: March 10, 2017, 08:31:32 am »
Hi,

I am trying to build codeblocks src code. But whenever I try to build it, it shows me error in app.cpp file.
Is this error common to all or I am the one getting it. I have added a screenshot for reference
Build Log:
Code: [Select]
-------------- Build: src in Code::Blocks wx2.8.x (compiler: GNU GCC Compiler)---------------

mingw32-g++.exe -Wall -g -pipe -mthreads -fmessage-length=0 -fexceptions -Winvalid-pch -Wno-unused-local-typedefs -std=gnu++11 -DHAVE_W32API_H -D__WXMSW__ -DWXUSINGDLL -DcbDEBUG -DCB_PRECOMP -DWX_PRECOMP -DwxUSE_UNICODE -DBUILDING_PLUGIN -Wno-deprecated-declarations -Wno-unused-local-typedefs -std=gnu++11 -iquote.objs\include -I.objs\include -I. -IC:\wxMSW-2.8.12\wxMSW-2.8.12\include -IC:\wxMSW-2.8.12\wxMSW-2.8.12\lib\gcc_dll\mswu -Isdk\wxscintilla\include -Isdk\wxpropgrid\include -Iinclude\tinyxml -IC:\MinGW\include -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 -Iexchndl\win32\include -IC:\wxMSW-2.8.12\wxMSW-2.8.12\lib\gcc_dll\mswud -IC:\MinGW\include -ID:\nebo\codeblocks_wit_extra_feature\src\sdk\wxscintilla\include -ID:\nebo\codeblocks_wit_extra_feature\src\include -ID:\nebo\codeblocks_wit_extra_feature\src\include\tinyxml -c D:\nebo\codeblocks_wit_extra_feature\src\src\app.cpp -o .objs\src\app.o
D:\nebo\codeblocks_wit_extra_feature\src\src\app.cpp: In function 'void EnableLFH()':
D:\nebo\codeblocks_wit_extra_feature\src\src\app.cpp:822:62: error: 'HEAP_INFORMATION_CLASS' has not been declared
         typedef BOOL  (WINAPI *HeapSetInformation_t)(HANDLE, HEAP_INFORMATION_CLASS, PVOID, SIZE_T);
                                                              ^
D:\nebo\codeblocks_wit_extra_feature\src\src\app.cpp:838:47: error: 'HeapCompatibilityInformation' was not declared in this scope
                 HeapSetInformation_func(h[i], HeapCompatibilityInformation, &HeapFragValue, sizeof(HeapFragValue));
                                               ^
Process terminated with status 1 (0 minute(s), 17 second(s))
2 error(s), 0 warning(s) (0 minute(s), 17 second(s))

On checking the location where HEAP_INFORMATION is defined, I get to know that it is defined in C;\MINGW\include\winnt.h. I am including this path in compiler (search directories/compiler -> C:\MINGW\include). But still this error is continued to come.
P.S: Yes, I have included winnt.h header file in app.cpp

But if I copy the HEAP_INFORMATION_CLASS enum from file "winnt.h" and paste it inside "app.cpp" it starts working fine.
Why I am experiencing this strange behaviour, Any idea?
« Last Edit: March 10, 2017, 09:14:56 am by anandamu16 »

Online ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 4917
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: Error while building codeblocks src code
« Reply #1 on: March 10, 2017, 09:19:02 am »
Which GCC compiler did you use? (It can be shown by the gcc -v command)
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline anandamu16

  • Multiple posting newcomer
  • *
  • Posts: 97
Re: Error while building codeblocks src code
« Reply #2 on: March 10, 2017, 09:22:35 am »
Also building forward, codeblocks gave me error in debuggergdb.cpp file also
Code: [Select]
-------------- Build: tinyXML in Code::Blocks wx2.8.x (compiler: GNU GCC Compiler)---------------

Target is up to date.

-------------- Build: AutoRevision in Code::Blocks wx2.8.x (compiler: GNU GCC Compiler)---------------

Target is up to date.

-------------- Build: ConsoleRunner in Code::Blocks wx2.8.x (compiler: GNU GCC Compiler)---------------

Target is up to date.

-------------- Build: Squirrel in Code::Blocks wx2.8.x (compiler: GNU GCC Compiler)---------------

Target is up to date.

-------------- Build: Squirrel std lib in Code::Blocks wx2.8.x (compiler: GNU GCC Compiler)---------------

Target is up to date.

-------------- Build: SqPlus in Code::Blocks wx2.8.x (compiler: GNU GCC Compiler)---------------

Target is up to date.

-------------- Build: scintilla in Code::Blocks wx2.8.x (compiler: GNU GCC Compiler)---------------

Target is up to date.

-------------- Build: wxpropgrid in Code::Blocks wx2.8.x (compiler: GNU GCC Compiler)---------------

Target is up to date.
Running target pre-build steps
build_tools\autorevision\autorevision +wx +int +t .. include/autorevision.h
'svn' is not recognized as an internal or external command,
operable program or batch file.

-------------- Build: sdk in Code::Blocks wx2.8.x (compiler: GNU GCC Compiler)---------------

Target is up to date.
Running target post-build steps
cmd /c if not exist devel\share\CodeBlocks mkdir devel\share\CodeBlocks
zip -jq9 devel\share\CodeBlocks\manager_resources.zip sdk\resources\*.xrc
cmd /c "cd sdk\resources & zip -0 -q ..\..\devel\share\CodeBlocks\manager_resources.zip images\*.png images\12x12\*.png images\16x16\*.png"
Running target pre-build steps
cmd /c if exist devel\exchndl.dll del devel\exchndl.dll

-------------- Build: src in Code::Blocks wx2.8.x (compiler: GNU GCC Compiler)---------------

Target is up to date.
Running target post-build steps
cmd /c if not exist devel\share\CodeBlocks mkdir devel\share\CodeBlocks
zip -jq9 devel\share\CodeBlocks\resources.zip src\resources\*.xrc
zip -jq9 devel\share\CodeBlocks\start_here.zip src\resources\start_here\*.html src\resources\start_here\*.png
cmd /c "cd src\resources & zip -0 -q ..\..\devel\share\CodeBlocks\resources.zip images\*.png images\16x16\*.png"
cmd /c if not exist devel\exchndl.dll if exist exchndl\win32\bin\*.dll xcopy /Y exchndl\win32\bin\*.dll devel\
exchndl\win32\bin\dbghelp.dll
exchndl\win32\bin\exchndl.dll
exchndl\win32\bin\mgwhelp.dll
exchndl\win32\bin\symsrv.dll
4 File(s) copied
cmd /c if not exist devel\symsrv.yes if exist exchndl\win32\bin\symsrv.yes xcopy /Y exchndl\win32\bin\symsrv.yes devel\

-------------- Build: Abbreviations in Code::Blocks wx2.8.x (compiler: GNU GCC Compiler)---------------

Target is up to date.
Running target post-build steps
cmd /c if not exist devel\share\CodeBlocks mkdir devel\share\CodeBlocks
zip -jq9 devel\share\CodeBlocks\abbreviations.zip plugins\abbreviations\resources\manifest.xml plugins\abbreviations\resources\*.xrc

-------------- Build: AStyle in Code::Blocks wx2.8.x (compiler: GNU GCC Compiler)---------------

Target is up to date.
Running target post-build steps
cmd /c if not exist devel\share\CodeBlocks mkdir devel\share\CodeBlocks
zip -jq9 devel\share\CodeBlocks\Astyle.zip plugins\astyle\resources\manifest.xml plugins\astyle\resources\*.xrc

-------------- Build: Autosave in Code::Blocks wx2.8.x (compiler: GNU GCC Compiler)---------------

Target is up to date.
Running target post-build steps
cmd /c if not exist devel\share\CodeBlocks mkdir devel\share\CodeBlocks
zip -jq9 devel\share\CodeBlocks\autosave.zip plugins\autosave\manifest.xml plugins\autosave\*.xrc

-------------- Build: Compiler depslib in Code::Blocks wx2.8.x (compiler: GNU GCC Compiler)---------------

Target is up to date.

-------------- Build: Compiler in Code::Blocks wx2.8.x (compiler: GNU GCC Compiler)---------------

Target is up to date.
Running target post-build steps
cmd /c if not exist devel\share\CodeBlocks mkdir devel\share\CodeBlocks
zip -jq9 devel\share\CodeBlocks\compiler.zip plugins\compilergcc\resources\manifest.xml plugins\compilergcc\resources\*.xrc
cmd /c "cd plugins\compilergcc\resources & zip -0 -q ..\..\..\devel\share\CodeBlocks\compiler.zip images\*.png images\16x16\*.png"
cmd /c if not exist devel\share\CodeBlocks\compilers mkdir devel\share\CodeBlocks\compilers
cmd /c xcopy /D /Y plugins\compilergcc\resources\compilers\*.* devel\share\CodeBlocks\compilers
0 File(s) copied

-------------- Build: Debugger in Code::Blocks wx2.8.x (compiler: GNU GCC Compiler)---------------

mingw32-g++.exe -Wall -g -pipe -mthreads -fmessage-length=0 -fexceptions -Winvalid-pch -Wno-unused-local-typedefs -std=gnu++11 -DHAVE_W32API_H -D__WXMSW__ -DWXUSINGDLL -DcbDEBUG -DCB_PRECOMP -DWX_PRECOMP -DwxUSE_UNICODE -DBUILDING_PLUGIN -Wno-deprecated-declarations -Wno-unused-local-typedefs -std=gnu++11 -iquote.objs\include -I.objs\include -I. -IC:\wxMSW-2.8.12\wxMSW-2.8.12\include -IC:\wxMSW-2.8.12\wxMSW-2.8.12\lib\gcc_dll\mswu -Isdk\wxscintilla\include -Isdk\wxpropgrid\include -Iinclude\tinyxml -IC:\MinGW\include -Iinclude -Iinclude\scripting\include -Iinclude\scripting\sqplus -IC:\wxMSW-2.8.12\wxMSW-2.8.12\lib\gcc_dll\mswud -IC:\MinGW\include -ID:\nebo\codeblocks_wit_extra_feature\src\sdk\wxscintilla\include -ID:\nebo\codeblocks_wit_extra_feature\src\include -ID:\nebo\codeblocks_wit_extra_feature\src\include\tinyxml -c D:\nebo\codeblocks_wit_extra_feature\src\plugins\debuggergdb\debuggergdb.cpp -o .objs\plugins\debuggergdb\debuggergdb.o
D:\nebo\codeblocks_wit_extra_feature\src\plugins\debuggergdb\debuggergdb.cpp: In member function 'void DebuggerGDB::DoBreak(bool)':
D:\nebo\codeblocks_wit_extra_feature\src\plugins\debuggergdb\debuggergdb.cpp:1607:17: error: 'CreateToolhelp32SnapshotFunc' was not declared in this scope
             && (CreateToolhelp32SnapshotFunc!=NULL)
                 ^
D:\nebo\codeblocks_wit_extra_feature\src\plugins\debuggergdb\debuggergdb.cpp:1608:17: error: 'Process32FirstFunc' was not declared in this scope
             && (Process32FirstFunc!=NULL)
                 ^
D:\nebo\codeblocks_wit_extra_feature\src\plugins\debuggergdb\debuggergdb.cpp:1609:17: error: 'Process32NextFunc' was not declared in this scope
             && (Process32NextFunc!=NULL) )
                 ^
D:\nebo\codeblocks_wit_extra_feature\src\plugins\debuggergdb\debuggergdb.cpp:1611:56: error: 'TH32CS_SNAPALL' was not declared in this scope
             HANDLE snap = CreateToolhelp32SnapshotFunc(TH32CS_SNAPALL,0);
                                                        ^
D:\nebo\codeblocks_wit_extra_feature\src\plugins\debuggergdb\debuggergdb.cpp:1614:17: error: 'PROCESSENTRY32' was not declared in this scope
                 PROCESSENTRY32 lppe;
                 ^
D:\nebo\codeblocks_wit_extra_feature\src\plugins\debuggergdb\debuggergdb.cpp:1615:17: error: 'lppe' was not declared in this scope
                 lppe.dwSize = sizeof(PROCESSENTRY32);
                 ^
D:\nebo\codeblocks_wit_extra_feature\src\plugins\debuggergdb\debuggergdb.cpp:1635:18: error: 'DebugBreakProcessFunc' was not declared in this scope
             if (!DebugBreakProcessFunc)
                  ^
Process terminated with status 1 (0 minute(s), 8 second(s))
7 error(s), 0 warning(s) (0 minute(s), 8 second(s))
 
  When I checked the declarations, It was already available in the same file (debuggergdb.cpp) as
Quote
#if defined(_WIN32_WINNT) && (_WIN32_WINNT >= 0x0501)
#include "Tlhelp32.h"
typedef BOOL WINAPI   (*DebugBreakProcessApiCall)       (HANDLE);
typedef HANDLE WINAPI (*CreateToolhelp32SnapshotApiCall)(DWORD  dwFlags,   DWORD             th32ProcessID);
typedef BOOL WINAPI   (*Process32FirstApiCall)          (HANDLE hSnapshot, LPPROCESSENTRY32W lppe);
typedef BOOL WINAPI   (*Process32NextApiCall)           (HANDLE hSnapshot, LPPROCESSENTRY32W lppe);

DebugBreakProcessApiCall        DebugBreakProcessFunc = 0;
CreateToolhelp32SnapshotApiCall CreateToolhelp32SnapshotFunc = 0;
Process32FirstApiCall           Process32FirstFunc = 0;
Process32NextApiCall            Process32NextFunc = 0;

HINSTANCE kernelLib = 0;

#endif

I have already tried to change "TlHelp32.h" to "tlhelp32.h". But that also didn't work.
Now If I will remove these 2 lines,
Quote
#if defined(_WIN32_WINNT) && (_WIN32_WINNT >= 0x0501)

Quote
#endif
it will build up finally.

Any reason for this strange behaviour.?

I am using MINGW Compiler 5.3.0. wxwidget2.8.12 Codeblocks trunk source code available at svn://svn.code.sf.net/p/codeblocks/code/trunk

Offline anandamu16

  • Multiple posting newcomer
  • *
  • Posts: 97
Re: Error while building codeblocks src code
« Reply #3 on: March 10, 2017, 09:23:34 am »
Quote
Which GCC compiler did you use? (It can be shown by the gcc -v command)

MINGW:gcc 5.3.0

Online ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 4917
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: Error while building codeblocks src code
« Reply #4 on: March 10, 2017, 09:43:30 am »
Quote
Which GCC compiler did you use? (It can be shown by the gcc -v command)

MINGW:gcc 5.3.0
This is not enough. Please give more details about the "gcc -v" command.
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline anandamu16

  • Multiple posting newcomer
  • *
  • Posts: 97
Re: Error while building codeblocks src code
« Reply #5 on: March 10, 2017, 12:38:31 pm »
C:\Users\zbcqcm>gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=c:/mingw/bin/../libexec/gcc/mingw32/5.3.0/lto-wrapper.exe
Target: mingw32
Configured with: ../src/gcc-5.3.0/configure --build=x86_64-pc-linux-gnu --host=m
ingw32 --prefix=/mingw --disable-win32-registry --target=mingw32 --with-arch=i58
6 --enable-languages=c,c++,objc,obj-c++,fortran,ada --enable-static --enable-sha
red --enable-threads --with-dwarf2 --disable-sjlj-exceptions --enable-version-sp
ecific-runtime-libs --with-libintl-prefix=/mingw --enable-libstdcxx-debug --with
-tune=generic --enable-libgomp --disable-libvtv --enable-nls : (reconfigured) ..
/src/gcc-5.3.0/configure --build=x86_64-pc-linux-gnu --host=mingw32 --prefix=/mi
ngw --disable-win32-registry --target=mingw32 --with-arch=i586 --enable-language
s=c,c++,objc,obj-c++,fortran,ada --enable-static --enable-shared --enable-thread
s --with-dwarf2 --disable-sjlj-exceptions --enable-version-specific-runtime-libs
 --with-libiconv-prefix=/mingw --with-libintl-prefix=/mingw --enable-libstdcxx-d
ebug --with-tune=generic --enable-libgomp --disable-libvtv --enable-nls
Thread model: win32
gcc version 5.3.0 (GCC)

Online ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 4917
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: Error while building codeblocks src code
« Reply #6 on: March 10, 2017, 03:11:43 pm »
OK, I never see this error.
It looks like you are using a MinGW based GCC compiler (Not MinGW-w64based). Maybe the value _WIN32_WINNT is not correctly defined.
You can use the Macro debugging tool to see what is it's value. See http://stackoverflow.com/a/10227059/154911
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline stahta01

  • Lives here!
  • ****
  • Posts: 5869
    • My Best Post
Re: Error while building codeblocks src code
« Reply #7 on: March 10, 2017, 04:34:20 pm »
OK, I never see this error.
It looks like you are using a MinGW based GCC compiler (Not MinGW-w64based). Maybe the value _WIN32_WINNT is not correctly defined.
You can use the Macro debugging tool to see what is it's value. See http://stackoverflow.com/a/10227059/154911

It likely too low of a value. As I told the last person with this question set to a good value.

Like below in the Project target define area of Compiler Settings.
Code: [Select]
_WIN32_WINNT=0x0601

Edit: Looks like the normal CB way is to set WINVER instead of _WIN32_WINNT directly.
Code: [Select]
WINVER=0x0501

Tim S.
« Last Edit: March 10, 2017, 04:40:30 pm by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 32 bit.
On Debian Testing, compiling CB Trunk against wxWidgets 3.0.2.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline anandamu16

  • Multiple posting newcomer
  • *
  • Posts: 97
Re: Error while building codeblocks src code
« Reply #8 on: March 13, 2017, 10:05:43 am »
ok.
So you mean to say I should explicitly define it as
Quote
_WIN32_WINNT=0x0601
"project->Build Options->Compiler Settings-> Defines"

I will try it. Thanks :)
Also any idea for this error ?
Quote
Hi,

I am trying to build codeblocks src code. But whenever I try to build it, it shows me error in app.cpp file.
Is this error common to all or I am the one getting it. I have added a screenshot for reference
Build Log:
Code: [Select]
-------------- Build: src in Code::Blocks wx2.8.x (compiler: GNU GCC Compiler)---------------

mingw32-g++.exe -Wall -g -pipe -mthreads -fmessage-length=0 -fexceptions -Winvalid-pch -Wno-unused-local-typedefs -std=gnu++11 -DHAVE_W32API_H -D__WXMSW__ -DWXUSINGDLL -DcbDEBUG -DCB_PRECOMP -DWX_PRECOMP -DwxUSE_UNICODE -DBUILDING_PLUGIN -Wno-deprecated-declarations -Wno-unused-local-typedefs -std=gnu++11 -iquote.objs\include -I.objs\include -I. -IC:\wxMSW-2.8.12\wxMSW-2.8.12\include -IC:\wxMSW-2.8.12\wxMSW-2.8.12\lib\gcc_dll\mswu -Isdk\wxscintilla\include -Isdk\wxpropgrid\include -Iinclude\tinyxml -IC:\MinGW\include -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 -Iexchndl\win32\include -IC:\wxMSW-2.8.12\wxMSW-2.8.12\lib\gcc_dll\mswud -IC:\MinGW\include -ID:\nebo\codeblocks_wit_extra_feature\src\sdk\wxscintilla\include -ID:\nebo\codeblocks_wit_extra_feature\src\include -ID:\nebo\codeblocks_wit_extra_feature\src\include\tinyxml -c D:\nebo\codeblocks_wit_extra_feature\src\src\app.cpp -o .objs\src\app.o
D:\nebo\codeblocks_wit_extra_feature\src\src\app.cpp: In function 'void EnableLFH()':
D:\nebo\codeblocks_wit_extra_feature\src\src\app.cpp:822:62: error: 'HEAP_INFORMATION_CLASS' has not been declared
         typedef BOOL  (WINAPI *HeapSetInformation_t)(HANDLE, HEAP_INFORMATION_CLASS, PVOID, SIZE_T);
                                                              ^
D:\nebo\codeblocks_wit_extra_feature\src\src\app.cpp:838:47: error: 'HeapCompatibilityInformation' was not declared in this scope
                 HeapSetInformation_func(h, HeapCompatibilityInformation, &HeapFragValue, sizeof(HeapFragValue));
                                               ^
Process terminated with status 1 (0 minute(s), 17 second(s))
2 error(s), 0 warning(s) (0 minute(s), 17 second(s))

On checking the location where HEAP_INFORMATION is defined, I get to know that it is defined in C;\MINGW\include\winnt.h. I am including this path in compiler (search directories/compiler -> C:\MINGW\include). But still this error is continued to come.
P.S: Yes, I have included winnt.h header file in app.cpp

But if I copy the HEAP_INFORMATION_CLASS enum from file "winnt.h" and paste it inside "app.cpp" it starts working fine.
Why I am experiencing this strange behaviour, Any idea?

Offline sodev

  • Multiple posting newcomer
  • *
  • Posts: 86
Re: Error while building codeblocks src code
« Reply #9 on: March 13, 2017, 03:27:48 pm »
Fix your includes! You are including mswu and mswud subdirectories of wxWidgets, this is plain wrong, you must not specify them from two different build configurations. Plus you are including directories from two different CodeBlocks trees, one set uses relative paths, the other absolute paths to something on drive D.