User forums => Using Code::Blocks => Topic started by: Jungle on August 31, 2012, 12:54:17 pm
Title: How can i get CompilerID from compiler name?
Post by: Jungle on August 31, 2012, 12:54:17 pm
I've recently spent much time trying to find out why SetCompilerID() doesn't work. I thought that CompilerID == compiler name, but i was wrong. So the question is: how can i get Compiler ID from compiler name?
Title: Re: How can i get CompilerID from compiler name?
Post by: Alpha on August 31, 2012, 02:19:41 pm
Code
wxString name = wxT("My Example Compiler"); Compiler* comp = CompilerFactory::GetCompilerByName(name); comp->GetID();
Title: Re: How can i get CompilerID from compiler name?
Post by: Jungle on August 31, 2012, 03:05:29 pm
That is what i get when calling from Wizard script:
Quote
SquirrelFunction<> call failed AN ERROR HAS OCCURED [the index 'GetCompilerByName' does not exist]
And there is no GetCompilerByName function on the "Scripting commands" wiki page.
Title: Re: How can i get CompilerID from compiler name?
Post by: Alpha on August 31, 2012, 03:40:28 pm
Sorry, I did not realize you were scripting.
What is it you are trying to achieve? Is it that you have a compiler's name (from somewhere), and are trying to set a build target/project to use that compiler?
Title: Re: How can i get CompilerID from compiler name?
Post by: Jungle on August 31, 2012, 04:01:57 pm
Yes, i've created 2 new compiler profiles which i use from project wizard script (without compiler selection page). Of course i've already got compiler id's. But i'm not sure that they will always stay the same.
Title: Re: How can i get CompilerID from compiler name?
Post by: Alpha on September 01, 2012, 01:53:48 pm
From what I can tell, you are correct; the required functions are not bound. If you wanted, you could edit sdk/scripting/bindings/scriptbindings.cpp to add the functionality.
Probably in your situation it would be good enough to simply script in the expected values (the alternative requires editing Code::Blocks).
(A note about how Code::Blocks uses compilers: the user is allowed to rename them, however, their ID's are always supposed to remain the same.)