Author Topic: Getting the Code::Blocks Build Message  (Read 2170 times)

Offline threeS

  • Multiple posting newcomer
  • *
  • Posts: 36
Getting the Code::Blocks Build Message
« on: October 26, 2014, 09:50:40 am »
Good day!

Is there any class or way to parse the raw output from compiling c/cpp?
The one that is used in the build messages tab.

Im using Code::Blocks 13.12 under Ubuntu 14.04 64bit.

Thanks for the help.,
More Power to all.  :)
« Last Edit: October 26, 2014, 10:39:12 am by threeS »

Offline Alpha

  • Developer
  • Lives here!
  • *****
  • Posts: 1513
Re: Getting the Code::Blocks Build Message
« Reply #1 on: October 26, 2014, 09:05:39 pm »
Take a look into the compiler plugin.  It uses a series of regexes on each message to pull the relevant parts.  They are mostly defined in plugins/compilergcc/resources/compilers/*.xml

Offline Bat

  • Multiple posting newcomer
  • *
  • Posts: 48
Re: Getting the Code::Blocks Build Message
« Reply #2 on: October 30, 2014, 11:49:31 pm »
Here I have added a custom message for this purpose (see patch)

Usage in plugin :
Register in constructor (here CompilerLCC)
And use in registered function. Each log line is passed in event.title

Code: [Select]
    Manager::Get()->RegisterEventSink(cbEVT_ADD_BUILD_LOG, new cbEventFunctor<CompilerLCC, CodeBlocksLogEvent>(this, &CompilerLCC::OnAddLog));

void CompilerLCC::OnAddLog(CodeBlocksLogEvent& event)
{
    if (event.title.StartsWith(_T("lcclnk"))) ...
}

It permit to handle things that don't really fit on standard Regexp handler