Developer forums (C::B DEVELOPMENT STRICTLY!) > Development

C::B trunk on MacOS: Commands between `backticks` do not work

(1/2) > >>


Building a code that links against wxwidgets does not work on C::B (trunk) on MacOS because the commands between backticks are not returned.

They are the usual

--- Code: ---`wx-config --cxxlibs`
`wx-config --libs std,aui`

--- End code ---

- If I run C::B from the Mac bundle from within the terminal:

--- Code: ---cd

--- End code ---

then everything works, e.g.:

--- Code: ---clang++ -Wall -g -std=c++11 -I/Users/federico/Downloads/wx/3.1.7/build-cocoa-debug/lib/wx/include/osx_cocoa-unicode-3.1 -I/Users/federico/Downloads/wx/3.1.7/include -D_FILE_OFFSET_BITS=64 -DWXUSINGDLL -D__WXMAC__ -D__WXOSX__ -D__WXOSX_COCOA__  -c /Users/federico/....

--- End code ---

If instead I open C::B by clicking on the package Icon, I get for the same file:

--- Code: ---clang++ -Wall -g -std=c++11  -c /Users/federico/.....

--- End code ---

Notice there's a double space where the includes should be, so the call to wx-config is returning Codeblocks an empty string.

Anyone experienced that before? I think the Mac may be sending output to that command somewhere else which is not returned properly?

Two things on backticks and building issues that I have seen are::
* Watch what shell you have setup C::B to use for "Shell to run commands in:" via the settings->environment->general settings tab option. I found zsh has quirks compared to bash.
* If you look at the following two files you will see how I have solved the issue of the wx-config and pkg-config:
* for the package icon difference if you use the full path to the wx-config and pkg-config then in my testing both ways of starting C::B works.

I found that no Mac GUI app has access to the environment variables, they only apply to command-line shells
(see for example

So, the standard way of calling wxwidgets flags via `wx-config --clibs` is never going to work on C::B on Mac if run from the packaged app.

I think the only way is to go back to use the global variable environment and define full-path commands like

--- Code: ---`$(#wx)/wx-config --cflags`

--- End code ---

where $(#wx) is defined as the path-to-wx-config.
Unfortunately I see that wxwidgets GUI template projects do not use those wx global variables anymore, they've also switched
to using wx-config commands everywhere. I think this is never going to work on Mac apps.


--- Quote from: AndrewCot on July 19, 2022, 12:04:03 am ---   
* If you look at the following two files you will see how I have solved the issue of the wx-config and pkg-config:
--- End quote ---

I see you've defined global variables for all commands. It seems like that's going to be the way to go. Older C::B versions had a
wizard to help you set them up for the local wx installation, but I notice that the new "wxWidgets GUI" project templates have instead
started to use `wx-config` calls with backticks, which is not a problem on unix or windows, but it is on MacOS, apparently.

*** FIXED ***

my bad, I was exporting wxWidgets $PATH from the .zprofile file, which only applies to terminal shells.
Moving that to .zshenv has solved the issue.

For reference, see this discussion here:


[0] Message Index

[#] Next page

Go to full version