News:

The new Release 25.03 is out! You can download binaries for Windows and many major Linux distros here .

Main Menu

Compiling codeblocks original source code to develop my own customized codeblock

Started by anandamu16, February 05, 2017, 06:40:32 AM

Previous topic - Next topic

BlueHazzard


anandamu16

Oh Thanks,

update.bat works fine, It copied all the code from backend and placed it on desired position.
Please let me know, if any other file I need to run.

anandamu16

Hi Tim,

QuotePlease verify that _WIN32_WINNT >= 0x0501 and if cross compiling "Tlhelp32.h" may need to be changed to "tlhelp32.h".

Can you tell me, how to verify that "_WIN32_WINNT >= 0x0501" ?

stahta01

Quote from: anandamu16 on February 15, 2017, 02:04:32 PM
Hi Tim,

QuotePlease verify that _WIN32_WINNT >= 0x0501 and if cross compiling "Tlhelp32.h" may need to be changed to "tlhelp32.h".

Can you tell me, how to verify that "_WIN32_WINNT >= 0x0501" ?

To try to display the value; but, I normally just define it to what I want it to be.

#include <iostream>

#include <w32api.h>
#include <windef.h>

using namespace std;

int main()
{
    cout << "_WIN32_WINNT := " << _WIN32_WINNT << endl;
    return 0;
}


Tim S.
C Programmer working to learn more about C++.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. [url="http://wiki.codeblocks.org"]http://wiki.codeblocks.org[/url]

anandamu16

ok Thanks.

I asked that question because I want to know, Is there any way to debug Codeblocks sdk code while building?
I mean, suppose I made some changes in different file of codeblocks sdk and I want to check its effect before releasing Binary, Is it a way to debug?

May be I am asking a bit silly questions here, but I just want to be clear.

BlueHazzard

Quoteany way to debug Codeblocks sdk code while building
you can't debug c/c++ code while building... You can debug code while execution... And yes you can debug codeblocks within codeblocks

QuoteI mean, suppose I made some changes in different file of codeblocks sdk and I want to check its effect before releasing Binary, Is it a way to debug?
no idea what you want to do... But "normally" you have to execute code to test it. There are some static code analyzer but i doubt this is a thing you want.

anandamu16

QuoteYou can debug code while execution... And yes you can debug codeblocks within codeblocks

I tried to debug the plugin code. I first build the plugin and then press debugger/continue icon with setting breakpoints at some places within code.

But the code gets debugged itself in no time and didn't stopped at any breakpoints. I mean while debugging, if I can set the breakpoints, code must get stopped at that breakpoint.
I have added the debugger output for your reference. I am doing something wrong or anything else is a problem

anandamu16

I realized, after building the code, I need to run i.e; execute the code. As soon as I execute the code, it gaves me the termination error with status -1

BlueHazzard

Please always post the whole text from the log windows as text within code tags (the # symbol in the post editor)  and not images. For first you are missing a lot information for the second it uses a lot more space on the server and for the third it is not readable on mobile devices...

QuoteI tried to debug the plugin code. I first build the plugin and then press debugger/continue icon with setting breakpoints at some places within code.

But the code gets debugged itself in no time and didn't stopped at any breakpoints. I mean while debugging, if I can set the breakpoints, code must get stopped at that breakpoint.
I have added the debugger output for your reference. I am doing something wrong or anything else is a problem
Please post the full debugger log and a rebuild log. I think your project is not configured properly...

QuoteI realized, after building the code, I need to run i.e; execute the code. As soon as I execute the code, it gaves me the termination error with status -1
well your code crashes, and you need the debugger to find the problem...

anandamu16

Sorry, I have added the build log, kindly check.


-------------- Clean: default in MenuPlugin (compiler: GNU GCC Compiler)---------------

Cleaned "MenuPlugin - default"

-------------- Build: default in MenuPlugin (compiler: GNU GCC Compiler)---------------

mingw32-g++.exe -DBUILDING_PLUGIN -DHAVE_W32API_H -D__WXMSW__ -DWXUSINGDLL -DcbDEBUG -DCB_PRECOMP -DWX_PRECOMP -DwxUSE_UNICODE -pipe -mthreads -fmessage-length=0 -fexceptions -Winvalid-pch -g -Wno-deprecated-declarations -Wno-unused-local-typedefs -std=gnu++11 -IC:\zbcqcm\codeblocks_svn_code\code\src\include -IC:\zbcqcm\codeblocks_svn_code\code\src\sdk\wxscintilla\include -IC:\wxMSW-2.8.12\wxMSW-2.8.12\include -IC:\wxMSW-2.8.12\wxMSW-2.8.12\lib\gcc_dll\mswu -IC:\wxMSW-2.8.12\wxMSW-2.8.12\lib\gcc_dll\mswud -IC:\MinGW\include -IC:\zbcqcm\codeblocks_svn_code\code\src\sdk\wxscintilla\include -IC:\zbcqcm\codeblocks_svn_code\code\src\include -IC:\zbcqcm\codeblocks_svn_code\code\src\include\tinyxml -c C:\Users\zbcqcm\Documents\Codeblocks_SVN\MenuPlugin\MenuPlugin.cpp -o .objs\MenuPlugin.o
mingw32-g++.exe -shared   -Wl,--dll -LC:\zbcqcm\codeblocks_svn_code\code\src\devel -LC:\wxMSW-2.8.12\wxMSW-2.8.12\lib\gcc_dll -LC:\wxMSW-2.8.12\wxMSW-2.8.12\lib\gcc_dll -L"C:\Program Files (x86)\CodeBlocks" .objs\MenuPlugin.o  -o MenuPlugin.dll -mthreads  -lcodeblocks -lwxmsw28u
Output file is MenuPlugin.dll with size 343.59 KB
Running target post-build steps
zip -j9 MenuPlugin.zip manifest.xml
zip -j9 MenuPlugin.cbplugin MenuPlugin.dll MenuPlugin.zip
updating: manifest.xml (152 bytes security) (deflated 54%)
updating: MenuPlugin.dll (152 bytes security) (deflated 70%)
updating: MenuPlugin.zip (152 bytes security) (deflated 14%)
Process terminated with status 0 (1 minute(s), 18 second(s))
0 error(s), 0 warning(s) (1 minute(s), 18 second(s))


-------------- Run: default in MenuPlugin (compiler: GNU GCC Compiler)---------------

Checking for existence: C:\Users\zbcqcm\Documents\Codeblocks_SVN\MenuPlugin\MenuPlugin.dll
Executing: "C:\zbcqcm\codeblocks_svn_code\code\src\devel\codeblocks.exe"  (in C:\Users\zbcqcm\Documents\Codeblocks_SVN\MenuPlugin\.)
Process terminated with status -1 (0 minute(s), 9 second(s))


My plugin is building fine besides It is installing properly into codeblocks. Error occurs only when I try to run my plugin.

P.S I will make sure to put the build log in text instead of images, Thanks.

BlueHazzard

From the debugger log i see that codeblocks exits immediately so there seems to be a error at startup. Where do you set the break point? Try to setting it in src/app.cpp line 582 and if it stops there try to continue. The debugger should report some sigfault or a like with a backtrace. Also you can try to enable Settings->Debugger->GDB->Default->Catch c++ exception

anandamu16

QuoteTry to setting it in src/app.cpp line 582 and if it stops there try to continue

I am compiling my plugin project, it doesn't have any app.cpp file. App.cpp file is a part of codeblocks sdk.
Since I dont have any file (app.cpp) in my project, I can't set breakpoints.

BlueHazzard

you can open your plugin and the codeblocks project file at the same time in codeblocks. Activate your plugin project by double click on it or by right click->activate project in the management pane.

Open the app.cpp file from codeblocks, set the break point at the line and start the debugger and your plugin will debugged, but codeblocks will halt at the break point...

anandamu16

my plugin is present in "c:/user/documents/Menuplugin"
my codeblocks svn code is present in "c:/xyz/codeblocks_svn_code"

To install the plugin, I open codeblocks.exe, go to plugin->manage plugins->Install New and direct it to MenuPlugin.cbplugin file
At backend it copies the MenuPlugin.dll file and put it incside codeblocks_svn_code under plugin section.

Plugin question:
So do I need to copy my complete source code and put it inside plugin section in codeblocks_svn_code?

Quoteyou can open your plugin and the codeblocks project file at the same time in codeblocks.
I try to do the same and got error - failed
Debugger log:
Active debugger config: GDB/CDB debugger:Default
Building to ensure sources are up-to-date
Selecting target:
default
Adding source dir: C:\Users\zbcqcm\Documents\Codeblocks_SVN\try_MenuPlugin_wxSmith_Combined\
Adding source dir: C:\Users\zbcqcm\Documents\Codeblocks_SVN\try_MenuPlugin_wxSmith_Combined\
Adding file: C:\zbcqcm\codeblocks_svn_code\code\src\devel\codeblocks.exe
Changing directory to: C:/Users/zbcqcm/Documents/Codeblocks_SVN/try_MenuPlugin_wxSmith_Combined/.
Set variable: PATH=.;C:\zbcqcm\codeblocks_svn_code\code\src\devel;C:\wxMSW-2.8.12\wxMSW-2.8.12\lib\gcc_dll;C:\MinGW\bin;C:\MinGW;C:\ProgramData\Oracle\Java\javapath;C:\Windows\System32;C:\Windows;C:\Windows\System32\wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Program Files\doxygen\bin;C:\Program Files (x86)\GtkSharp\2.12\bin;C:\Program Files (x86)\SEGGER\JLink_V610l;C:\GNU_Tools_ARM_Embedded\6.2_2016q4\bin;C:\arm-none-eabi-gcc-4.8.2_nl-1.19.0_bu-2.23.2-mingw32-netx.0\arm-none-eabi-gcc-4.8.2\arm-none-eabi\bin;C:\arm-none-eabi-gcc-4.8.2_nl-1.19.0_bu-2.23.2-mingw32-netx.0\arm-none-eabi-gcc-4.8.2\bin;C:\gcc-arm-none-eabi-6_2-2016q4-20161216-win32\arm-none-eabi\bin;C:\gcc-arm-none-eabi-6_2-2016q4-20161216-win32\bin;C:\SysGCC\arm-elf\bin;C:\SysGCC\arm-eabi\bin;C:\Program Files (x86)\AXSEM\AXSDB\bin;C:\Program Files\TortoiseSVN\bin;C:\Program Files\TortoiseGit\bin;C:\Program Files\Git\cmd;C:\TDM-GCC-32\bin;C:\Program Files (x86)\WinRAR;C:\Program Files (x86)\GNU Tools ARM Embedded\6.2 2016q4\bin;C:\Program Files (x86)\IAR Systems\Embedded Workbench 7.5\arm\bin;\\ C\CB_20161120_rev10922_win32\zip300xn-x64\zip300xn-x64;\\ C\boost\boost-jam-3.1.18-1-ntx86\boost-jam-3.1.18-1-ntx86;C:\Program Files\Git\bin;C:\cygwin64\bin;C:\codeblocks zip\zip300xn-x64\zip300xn-x64
Starting debugger: C:\Program Files (x86)\CodeBlocks\MINGW\bin\gdb.exe -nx -fullname -quiet  -args C:/zbcqcm/codeblocks_svn_code/code/src/devel/codeblocks.exe
failed


One more question, something deviating from topic
- I build codeblocks sdk code and as a result 2 additional folders were formed namely "devel", "output". Each containing codeblock.exe. I need to ask, which codeblock.exe I should work on?

stahta01

Quote from: anandamu16 on February 21, 2017, 05:36:09 AM
my plugin is present in "c:/user/documents/Menuplugin"
my codeblocks svn code is present in "c:/xyz/codeblocks_svn_code"

To install the plugin, I open codeblocks.exe, go to plugin->manage plugins->Install New and direct it to MenuPlugin.cbplugin file
At backend it copies the MenuPlugin.dll file and put it incside codeblocks_svn_code under plugin section.

Plugin question:
So do I need to copy my complete source code and put it inside plugin section in codeblocks_svn_code?

Quoteyou can open your plugin and the codeblocks project file at the same time in codeblocks.
I try to do the same and got error - failed
Debugger log:
Active debugger config: GDB/CDB debugger:Default
Building to ensure sources are up-to-date
Selecting target:
default
Adding source dir: C:\Users\zbcqcm\Documents\Codeblocks_SVN\try_MenuPlugin_wxSmith_Combined\
Adding source dir: C:\Users\zbcqcm\Documents\Codeblocks_SVN\try_MenuPlugin_wxSmith_Combined\
Adding file: C:\zbcqcm\codeblocks_svn_code\code\src\devel\codeblocks.exe
Changing directory to: C:/Users/zbcqcm/Documents/Codeblocks_SVN/try_MenuPlugin_wxSmith_Combined/.
Set variable: PATH=.;C:\zbcqcm\codeblocks_svn_code\code\src\devel;C:\wxMSW-2.8.12\wxMSW-2.8.12\lib\gcc_dll;C:\MinGW\bin;C:\MinGW;C:\ProgramData\Oracle\Java\javapath;C:\Windows\System32;C:\Windows;C:\Windows\System32\wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Program Files\doxygen\bin;C:\Program Files (x86)\GtkSharp\2.12\bin;C:\Program Files (x86)\SEGGER\JLink_V610l;C:\GNU_Tools_ARM_Embedded\6.2_2016q4\bin;C:\arm-none-eabi-gcc-4.8.2_nl-1.19.0_bu-2.23.2-mingw32-netx.0\arm-none-eabi-gcc-4.8.2\arm-none-eabi\bin;C:\arm-none-eabi-gcc-4.8.2_nl-1.19.0_bu-2.23.2-mingw32-netx.0\arm-none-eabi-gcc-4.8.2\bin;C:\gcc-arm-none-eabi-6_2-2016q4-20161216-win32\arm-none-eabi\bin;C:\gcc-arm-none-eabi-6_2-2016q4-20161216-win32\bin;C:\SysGCC\arm-elf\bin;C:\SysGCC\arm-eabi\bin;C:\Program Files (x86)\AXSEM\AXSDB\bin;C:\Program Files\TortoiseSVN\bin;C:\Program Files\TortoiseGit\bin;C:\Program Files\Git\cmd;C:\TDM-GCC-32\bin;C:\Program Files (x86)\WinRAR;C:\Program Files (x86)\GNU Tools ARM Embedded\6.2 2016q4\bin;C:\Program Files (x86)\IAR Systems\Embedded Workbench 7.5\arm\bin;\\ C\CB_20161120_rev10922_win32\zip300xn-x64\zip300xn-x64;\\ C\boost\boost-jam-3.1.18-1-ntx86\boost-jam-3.1.18-1-ntx86;C:\Program Files\Git\bin;C:\cygwin64\bin;C:\codeblocks zip\zip300xn-x64\zip300xn-x64
Starting debugger: C:\Program Files (x86)\CodeBlocks\MINGW\bin\gdb.exe -nx -fullname -quiet  -args C:/zbcqcm/codeblocks_svn_code/code/src/devel/codeblocks.exe
failed


One more question, something deviating from topic
- I build codeblocks sdk code and as a result 2 additional folders were formed namely "devel", "output". Each containing codeblock.exe. I need to ask, which codeblock.exe I should work on?

For running use the one in "output"; for debugging use the one in "devel".

You really NEED to learn how to build a contrib plugin for Code::Blocks; it will show you a lot!!
Before trying to build your own core CB plugin; you need to be able to build an contrib CB plugin.

Tim S.
C Programmer working to learn more about C++.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. [url="http://wiki.codeblocks.org"]http://wiki.codeblocks.org[/url]