Author Topic: Global Variable editor  (Read 5577 times)

Offline Дмитро

  • Multiple posting newcomer
  • *
  • Posts: 101
Global Variable editor
« on: December 05, 2015, 08:10:57 pm »
Global Variable editor


   I am clicking on the buttons took picture something Global Variable editor

  Please, please detail what the setting is and what role it plays.


Yes, I really do not understand. What are these things? Why? What are they?
« Last Edit: December 05, 2015, 09:35:24 pm by Дмитро »

Offline pirx67

  • Multiple posting newcomer
  • *
  • Posts: 35
Re: Global Variable editor
« Reply #1 on: December 05, 2015, 11:53:05 pm »

please click on the "Help" button on of the "Global Variable Editor" dialog. This will take you to the wiki where the purpose
of the global variables is explained (see link

You need that if you want to make use of 3rd party libraries (like wxWidgets) in a way that makes it possible to build your project
on another computer / Code::Blocks installation.

Also if you use Code::Blocks keep in mind that you should always create a project for developing your program because
Code::Blocks uses a project as kind of container to administer all settings, paths, dependencies and so on.


PS.: Please try to make your questions more explicit and and specific.

Offline cacb

  • Regular
  • ***
  • Posts: 398
Re: Global Variable editor
« Reply #2 on: December 06, 2015, 09:03:09 am »
Global Variable editor
Yes, I really do not understand. What are these things? Why? What are they?


The global variable editor allows you to define sets of Code::Blocks "global variables". Global variables are defined for each Code::Blocks installation, independent from the projects. The global variables are referenced/used in Code::Blocks project files.

For example, if you have a C++ library 'abc' with header files and .lib/.a files in
Header files  C:\somewhere\abc\include
library files  C:\somewhere\abc\lib

Then you can define a global variable 'ABC' in the global variable editor as follows
BASE:   ABC   C:\somewhere\abc

Then in your project, using the 'abc' library, you can specify the include and lib paths as $(#ABC.include) and $(#ABC.lib). See the Wiki for more details. The main idea is that you refer to global variables this way in C::B project files, instead of the file paths directly. Then you can easily move the project from one computer to another without editing the project, even when the file paths are different.

The idea of global variables is very powerful, and one of the main strong points of Code::Blocks. The editor itself is unfortunately not very intuitive, and it is easy to make mistakes. I have also found that the only way to make sure the variables are properly saved is to exit Code::Blocks (a bug if you ask me). I therefore recommend to exit/restart Code::Blocks after editing global variables.