Author Topic: Help Required.  (Read 7390 times)

Offline nahn1989

  • Single posting newcomer
  • *
  • Posts: 6
Help Required.
« on: January 10, 2012, 10:26:16 am »
Hi,

I want to develop a plugin for code::blocks. I compiled code::blocks nightly build rev 7671 on windows 7. If i use ListCtrlLogger in my plugin, on double click event, code::blocks crashes.

Please tell me how to compile the code blocks properly on windows 7.

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9699
Re: Help Required.
« Reply #1 on: January 10, 2012, 11:13:32 am »
See here:
http://wiki.codeblocks.org/index.php?title=Installing_Code::Blocks_from_source_on_Windows

Some more information is here:
http://wiki.codeblocks.org/index.php?title=Developer_documentation

Generally without code or more information it's hard to answer (if not impossible) why it is crashing.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline nahn1989

  • Single posting newcomer
  • *
  • Posts: 6
Re: Help Required.
« Reply #2 on: January 10, 2012, 12:37:44 pm »
Source code used is shown below.

namespace
{
const int ID_List = wxNewId();
};

BEGIN_EVENT_TABLE(Open_Tag_Log, wxEvtHandler)
//
END_EVENT_TABLE()

Open_Tag_Log ::Open_Tag_Log(const wxArrayString& Titles, wxArrayInt& Widths)
    : ListCtrlLogger(Titles, Widths)
{
}

Open_Tag_Log::~Open_Tag_Log()
{
  if (control && !Manager::IsAppShuttingDown())
  {
    control->RemoveEventHandler(this);
  }
}

wxWindow* Open_Tag_Log::CreateControl(wxWindow* parent)
{
  ListCtrlLogger::CreateControl(parent);
  control->SetId(ID_List);
  OpenTagLog.AppendToLog(_("Create Control Called"));
  Connect(ID_List, -1, wxEVT_COMMAND_LIST_ITEM_ACTIVATED,
            (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction)
            &Open_Tag_Log::OnDoubleClick);
  control->PushEventHandler(this);
  return control;
}

void Open_Tag_Log::OnDoubleClick(wxCommandEvent &event)
{
  // go to the relevant file/line
  OpenTagLog.AppendToLog(_("Double Click"));
  if (control->GetSelectedItemCount() == 0)
  {
    return;
  }
  // find selected item index
  const int Index = control->GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
  SyncEditor(Index);
}

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 6034
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: Help Required.
« Reply #3 on: January 10, 2012, 03:14:08 pm »
Or post all the plugin source here(as a zip file), so some one can have a look.
Mostly, I suggest you debug your plugin under gdb.
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline nahn1989

  • Single posting newcomer
  • *
  • Posts: 6
Re: Help Required.
« Reply #4 on: January 11, 2012, 04:36:46 am »
How to debug the plugin using GDB on windows platform?

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 6034
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: Help Required.
« Reply #5 on: January 11, 2012, 05:40:28 am »
How to debug the plugin using GDB on windows platform?

As Morten said, you need to build the Codeblocks from source under Windows.
Debug your plugin is the same as debug c::b.

You build your plugin, and start debug c::b, then the  c::b(debugee) will automatically load your plugin.

This is some kind of how to debug a dll. :)
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.