User forums > Using Code::Blocks
Global Variable editor
Дмитро:
Global Variable editor
Hello!
I am clicking on the buttons took picture something Global Variable editor
Please, please detail what the setting is and what role it plays.
Змінні.bmp
Yes, I really do not understand. What are these things? Why? What are they?
pirx67:
Hi,
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 http://wiki.codeblocks.org/index.php?title=Global_compiler_variables).
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.
Greets,
pirx67
PS.: Please try to make your questions more explicit and and specific.
cacb:
--- Quote from: Дмитро on December 05, 2015, 08:10:57 pm ---Global Variable editor
Yes, I really do not understand. What are these things? Why? What are they?
--- End quote ---
Hi,
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.
SelfTeachingC++:
Something is terribly wrong with all of this. Nothing works as it should. Everywhere I go, the explanation is a link to the manual, or the wiki (which is just a copy and paste of the manual, gee helpful)...and I follow it but nothing that works is what is written. Let's take boost for example, since that one is asked about most often. I've killed countless hours just trying to access the property tree library only to find out it won't work for what I need, but let's talk about it anyway.
Given the information here, and in the wiki, and in the manual, my boost global variable should be (my install folder is on my desktop...and yes I made sure to build it)
BASE:C:\Users\MyComputer\Desktop\boost_1_7_0
INCLUDE:C:\Users\MyComputer\Desktop\boost_1_7_0\boost
LIB:C:\Users\MyComputer\Desktop\boost_1_7_0\libs
and my build options menu should under search directories be:
compiler tab $(#boost.include)
linker tab $(#boost.lib)
then the include directive
#include <boost\property_tree\ptree.hpp>
BUT THAT DOESN'T WORK
It generates a No such file or directory error.
What actually works for me for property_tree is:
BASE:C:\Users\MyComputer\Desktop\boost_1_7_0\boost
INCLUDE:C:\Users\MyComputer\Desktop\boost_1_7_0
compiler tab $(#boost.include)
linker tab $(#boost.lib)
then #include <boost\property_tree\ptree.hpp>
OR
BASE:C:\Users\MyComputer\Desktop\boost_1_7_0\
INCLUDE:C:\Users\MyComputer\Desktop\boost_1_7_0\boost
compiler tab $(#boost)
linker tab $(#boost.lib)
then #include <boost\property_tree\ptree.hpp>
I KNOW, I KNOW, I KNOW that property tree is header only. Don't get me started on things that need linking to a library and that lib field. I just left it because it works with it there. I'm not going to take it out to see if it still works because I'd bet money that even though it's not needed, it wouldn't work without it.
Then, with other libraries having similar file structures, no combination seems to work at all let alone the combination it's supposed to be, making the manual and the wiki COMPLETE NONSENSE.
If there's a setting somewhere else that makes this work the way the manual says, please someone tell me. Maybe there's an explanation somewhere other than the manual as to exactly what "BASE" and "INCLUDE" actually mean instead of what they intuitively mean or what the manual says they mean. If there were, it would help me immensely.
In contrast if all someone has to say is, "learn how to use your compiler", "look at the manual", or "do your research", save your breath. I already know it's coming. If you can find an original insult, you might give me a good laugh. I've spent countless hours reading about the compiler, the IDE, the library and every version of the codeblocks manual and copy/paste job to wiki I can find and trying every combination of paths I can just to try to figure out how the damn thing works and in the end there's absolutely no rhyme or reason to it.
>:(
stahta01:
--- Code: ---BASE:C:\Users\MyComputer\Desktop\boost_1_7_0
INCLUDE:C:\Users\MyComputer\Desktop\boost_1_7_0\boost
LIB:C:\Users\MyComputer\Desktop\boost_1_7_0\libs
--- End code ---
That include is likely wrong!
I use
--- Code: ---INCLUDE:C:\Users\MyComputer\Desktop\boost_1_7_0
--- End code ---
No idea about the LIB path; I only use boost header files.
Edit: The BASE is correct.
Tim S.
Navigation
[0] Message Index
[#] Next page
Go to full version