Author Topic: How can i get CompilerID from compiler name?  (Read 4756 times)

Offline Jungle

  • Single posting newcomer
  • *
  • Posts: 9
How can i get CompilerID from compiler name?
« 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?

Offline Alpha

  • Developer
  • Lives here!
  • *****
  • Posts: 1513
Re: How can i get CompilerID from compiler name?
« Reply #1 on: August 31, 2012, 02:19:41 pm »
Code
wxString name = wxT("My Example Compiler");
Compiler* comp = CompilerFactory::GetCompilerByName(name);
comp->GetID();

Offline Jungle

  • Single posting newcomer
  • *
  • Posts: 9
Re: How can i get CompilerID from compiler name?
« Reply #2 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.

Offline Alpha

  • Developer
  • Lives here!
  • *****
  • Posts: 1513
Re: How can i get CompilerID from compiler name?
« Reply #3 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?

Offline Jungle

  • Single posting newcomer
  • *
  • Posts: 9
Re: How can i get CompilerID from compiler name?
« Reply #4 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.

Offline Alpha

  • Developer
  • Lives here!
  • *****
  • Posts: 1513
Re: How can i get CompilerID from compiler name?
« Reply #5 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.)