Code::Blocks Forums

Developer forums (C::B DEVELOPMENT STRICTLY!) => Development => Topic started by: ollydbg on February 25, 2026, 02:39:15 am

Title: svn rev 13798 issue?
Post by: ollydbg on February 25, 2026, 02:39:15 am
Hi, Pecan, I see this commit:

https://sourceforge.net/p/codeblocks/code/13798/

Some of changes in the cbp files are not expected? I think the macro variable "CODEBLOCKS" is not needed here.
Title: Re: svn rev 13798 issue?
Post by: Pecan on February 25, 2026, 05:01:35 pm
Do you mean that it's causing an error. Where do you get the error?

What OS? What compiler? Which wxWidgets?

I can't reproduce an error. Can you give me some steps to cause the error?
Thanks
Title: Re: svn rev 13798 issue?
Post by: ollydbg on February 26, 2026, 01:46:50 am
You must have the compiler global variable CODEBLOCKS defined.

But that was not necessary.  For example, if you look at this cbp file and other cbp files.

https://github.com/arnholm/codeblocks_sfmirror/blob/master/src/plugins/contrib/SmartIndent/SmartIndent_wx32_64.cbp

You don't see any CODEBLOCKS variable needed.

I'm not sure you can understand my explanations.  But this compiler macro is not needed in cbp file and the update file.
Title: Re: svn rev 13798 issue?
Post by: Pecan on February 26, 2026, 06:33:53 am
$(CODEBLOCKS) is automatically defined by CB in macrosmanger. The user does not need to define it anywhere.

Are you getting errors when compiling codesnippets ?

The use of $(CODEBLOCKS) makes it easy to drag a contrib dir out of the local repo to a new separate directory and work with the contrib without .cbp changes. Then drag it back to the repo without making mistakes trying to fix the .cbp file. No changes, no mistakes.

Without using the macro, you cannot use the repo .cbp without making ../../.. changes all over the place, It  is much easier to use $(CODEBLOCKS)\..\ without making any changes to the .cbp(s) and the macro is build into the sdk source code builtin variables.
https://wiki.codeblocks.org/index.php/Variable_expansion
Title: Re: svn rev 13798 issue?
Post by: ollydbg on February 26, 2026, 08:48:30 am
First, this "CODEBLOCKS" is defined here:

Code
void MacrosManager::ClearProjectKeys()
{
    m_Macros.clear();

    m_Macros[_T("AMP")]        = _T("&");
    m_Macros[_T("CODEBLOCKS")] = m_AppPath;
    m_Macros[_T("APP_PATH")]   = m_AppPath;
    m_Macros[_T("APP-PATH")]   = m_AppPath;
    m_Macros[_T("APPPATH")]    = m_AppPath;
    m_Macros[_T("DATA_PATH")]  = m_DataPath;
    m_Macros[_T("DATA-PATH")]  = m_DataPath;
    m_Macros[_T("DATAPATH")]   = m_DataPath;
    m_Macros[_T("PLUGINS")]    = m_Plugins;
    m_Macros[_T("LANGUAGE")]   = wxLocale::GetLanguageName(wxLocale::GetSystemLanguage());
    m_Macros[_T("ENCODING")]   = wxLocale::GetSystemEncodingName();

But in my build environment, it can't be used.

Here is my situations:

1, I use a C::B(let's say it is the host C::B) to open and build C::B workspace. The build result is the client C::B.
2, The host C::B is usually download from my github action release which is using the latest release version of wx 3.3.1 and latest msys2, and the C runtime is UCRT.
3, The client C::B is usually link to the debug version of the wxWidgets. In my local PC, I have build debug version of wx 3.3.1 myself under gcc compiler(msys2, but the C runtime is MSVCRT, because some of my clients are still using Windows 7) to track errors.

If using $(CODEBLOCKS) method, I have to link the client C::B's plugin against the host C::B, that is not possible. Because they use different wxWidgets library, different GCC version, different C runtime library.
Title: Re: svn rev 13798 issue?
Post by: gd_on on February 26, 2026, 04:35:34 pm
Is there a way to display within Code::Blocks the content of environment variables that are set by MacrosManager, so AMP, CODEBLOCKS, APP_PATH, ...
Title: Re: svn rev 13798 issue?
Post by: Miguel Gimenez on February 26, 2026, 07:44:25 pm
Is there a way to display within Code::Blocks the content of environment variables that are set by MacrosManager, so AMP, CODEBLOCKS, APP_PATH, ...

I do not think so. There is a MacrosManager::GetMacros() method, currently unused, that would make easy to add this information to a tab in the About dialog (for example). This way the user does not have to search the Wiki.
Title: Re: svn rev 13798 issue?
Post by: Pecan on February 26, 2026, 08:00:30 pm
I've reverted the use of built-in variables in the codesnippets.cbp.

Sadly, this means we can never  use the built-in macros in a .cbp file.

Title: Re: svn rev 13798 issue?
Post by: Pecan on February 26, 2026, 08:05:01 pm
Is there a way to display within Code::Blocks the content of environment variables that are set by MacrosManager, so AMP, CODEBLOCKS, APP_PATH, ...

Would displaying the built-in vars within Code::Blocks allow us to use them in .cbp files?
Would that avoid the problems experienced by ollydbg?
Title: Re: svn rev 13798 issue?
Post by: ollydbg on February 27, 2026, 01:08:51 am
I've reverted the use of built-in variables in the codesnippets.cbp.

Sadly, this means we can never  use the built-in macros in a .cbp file.

Hello pecan, thanks for the fix.

I think basically linking the recent built plugin to the host CB has another issue. Sometimes
the host CB and the client CB have different SDK numbers, I'm just avoid doing that.

About print the Macro values,  Maybe we can have a Squirrel script to print all those values.

Title: Re: svn rev 13798 issue?
Post by: gd_on on February 27, 2026, 09:39:24 am
I have seen that inside ....\src\tools\test\macrosmanager there is a macrosmanager.cbp file. It can display variables in the C::B log window if you launch a build or full rebuild command. The display is a little bit heavy/confusing, but it exists!

PS: in some of the clangd_client_wx*.cbp, the $(CODEBLOCKS) variable is still used.
Title: Re: svn rev 13798 issue?
Post by: ollydbg on March 01, 2026, 02:24:51 am
I have seen that inside ....\src\tools\test\macrosmanager there is a macrosmanager.cbp file. It can display variables in the C::B log window if you launch a build or full rebuild command. The display is a little bit heavy/confusing, but it exists!

Oh, yes, this is a command like project, I see there are a lot of command line statement when you "build"(actually you do no build the project, but just run the command) the project.
Code
					<Add before="echo Code::Blocks location: $(CODEBLOCKS)" />
<Add before="echo Code::Blocks APP_PATH: $(APP_PATH)" />
<Add before="echo Code::Blocks DATA_PATH: $(DATA_PATH)" />
<Add before="echo Code::Blocks PLUGINS: $(PLUGINS)" />
<Add before="echo Code::Blocks LANGUAGE: $(LANGUAGE)" />
<Add before="echo Code::Blocks ENCODING: $(ENCODING)" />


Quote
PS: in some of the clangd_client_wx*.cbp, the $(CODEBLOCKS) variable is still used.

Let me fix them, I can find them by search the $(CODEBLOCKS) in all the *.cbp files.