OK, it seems you have confused a couple of concepts. Let's see...
Compiler ID: it is a unique identifier for each compiler registered with CompilerFactory. This ID is automatically assigned when the compiler is registered.
So, the following question is invalid (I hope you can see why):
I wonder why the Compiler::GetID() is not static
Let's move now to the other problem:
I want to compare against the IDs of some fixed compilers:
#include "../plugins/compilergcc/compilerGNUTRICORE.h"
...
CompilerGNUTRICORE tricoreGcc;
wxString tricoreGccID = tricoreGcc.GetID();
This obviously won't work. First, compilers must never be created on the stack but rather on the heap. Second, this compiler is not registered with CompilerFactory and not even compiled in the compiler plugin (hence the missing symbols).
And this is not the correct way to do either because you 're tying your code to a specific compiler by hardcoding #include paths and files. A plugin should
never rely on another plugin being loaded. You can get the pointer to another plugin if you want by using PluginManager's facilities. But that's not your problem here.
If all you want is to test against the ID of an existing compiler, then things are simple. IDs are simple strings and, unless specifically set in the compiler's constructor, they 're the same as the compiler's title converted to an XML-compliant format:
- only allow a-z, 0-9 and _ (other characters are removed, except space)
- any spaces are converted to underscores (_)
- if it starts with a number, "cb" is prepended
- finally it's always converted to lower-case
So, if you want to test if an ID refers to the "GNU GCC Compiler", a simple check
id==_T("gcc") will do the trick. Just adapt for the specific compiler you want to check for.
I hope I didn't confuse you more :).