Can't open a dialog from custom plugin

CodeLite installation/troubleshooting forum
underdoeg
CodeLite Enthusiast
Posts: 16
Joined: Sun May 01, 2011 11:43 pm
Genuine User: Yes
IDE Question: c++
Contact:

Can't open a dialog from custom plugin

Post by underdoeg »

Hi

I am working on a plugin for codelite that works a little bit like a project wizard. To do so, I have created a custom dialog that extends wxDialog.

And then when selected in the menu, I am showing it like this:

Code: Select all

void ofMaker::onNewOf(wxCommandEvent& e)
{
	//but its a modal dialogue for now
	OfDialog* ofDialog=new OfDialog(m_mgr->GetTheApp()->GetTopWindow());
	ofDialog->Show();
}
Now when I activate the plugin and select it in the menu, I get the following error:

Code: Select all

codelite: symbol lookup error: /usr/lib/codelite/OfProjectMaker.so: undefined symbol: _ZN8OfDialogC1EP8wxWindow
The dialog works though when I run it as a standalone wxWidgets application.

Code: Select all

#include <wx/wx.h>
#include "ofdialog.h"

// application class
class wxMiniApp : public wxApp
{
    public:
		// function called at the application initialization
        virtual bool OnInit();

		// event handler for button click
        void OnClick(wxCommandEvent& event) { GetTopWindow()->Close(); }
};

IMPLEMENT_APP(wxMiniApp);

bool wxMiniApp::OnInit()
{

	OfDialog ofDialog(NULL);
	ofDialog.Show();

	// enter the application's main loop
    return true;
}
Will be happy about any ideas. thx.
philip
User avatar
eranif
CodeLite Plugin
Posts: 6375
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Can't open a dialog from custom plugin

Post by eranif »

Can you post the code of your Dialog? it seems like the constructor of the dialog is missing..
You can run from a command line:

Code: Select all

c++filt _ZN8OfDialogC1EP8wxWindow
and it will tell you what symbol is missing (in your case: a constructor that accepts wxWindow)
Eran
Make sure you have read the HOW TO POST thread
underdoeg
CodeLite Enthusiast
Posts: 16
Joined: Sun May 01, 2011 11:43 pm
Genuine User: Yes
IDE Question: c++
Contact:

Re: Can't open a dialog from custom plugin

Post by underdoeg »

thanks

yes, you are right. I have a second cpp file with the class in it. It looks like this one is not being compiled, although I have it in my project.
So I copied all the contents of ofdialog.cpp into ofmaker.cpp (the main plugin code) and then it worked just fine. So the code is alright, it just doesn't get compiled.

It'd still be useful to keep this code separated. Any hints what I might be doing wrong?
You do not have the required permissions to view the files attached to this post.
User avatar
eranif
CodeLite Plugin
Posts: 6375
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Can't open a dialog from custom plugin

Post by eranif »

I am not sure how you are compiling / OS
I will need to see the project file / build log in order to answer that question
Eran
Make sure you have read the HOW TO POST thread
underdoeg
CodeLite Enthusiast
Posts: 16
Joined: Sun May 01, 2011 11:43 pm
Genuine User: Yes
IDE Question: c++
Contact:

Re: Can't open a dialog from custom plugin

Post by underdoeg »

I am on linux ubuntu 64bit.

I have the project hosted on github if you want to take a look at it: https://github.com/underdoeg/ofProjectM ... r-CodeLite

With the hack I mentioned it all works fine. But it is a little bit ugly because now I have double code...

thank you
User avatar
eranif
CodeLite Plugin
Posts: 6375
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Can't open a dialog from custom plugin

Post by eranif »

As a quick tip, remove the following files from git, those are auto-generated and there is no sense of keeping them under source control:

- ofProjectMaker.tags
- ofMaker.mk
- ofProjectMaker.workspace.session
- ofProjectMaker_wsp.mk

When developing a plugin for codelite under Linux, you should be using codelite's configure script and not the codelite build system since codelite itself is being built using a custom makefile under linux. (this allows people to build codelite from scratch without the need to have codelite installed first)

Just open the file 'configure' and follow one of the other plugins (e.g. 'CodeFormatter')
You should be adding 3-4 entries (copy the CodeFormatter ones and replace it with your plugin)

Once you completed that, run './configure && make'

1) compile a codelite or install one
2) create an installation root: mkdir -p /home/username/somepath
3) checkout codelite sources, and run the configure as follows: ./configure --enable-debug --prefix=/home/username/somepath
4) make && make install

The last command will compile and will install codelite under /home/username/somepath
You can not set the target binary for debugging to /home/username/somepath/bin/codelite

Eran
Make sure you have read the HOW TO POST thread
underdoeg
CodeLite Enthusiast
Posts: 16
Joined: Sun May 01, 2011 11:43 pm
Genuine User: Yes
IDE Question: c++
Contact:

Re: Can't open a dialog from custom plugin

Post by underdoeg »

thanks for the tip. I wasn't sure which files are actually auto generated. Good to know!

I did develop the plugin according to your manual here: http://codelite.org/LiteEditor/CreatingNewPlugin

And now I know what I did wrong. I didn't rerun the configure script after adding the new cpp file. Quite an obvious error now...

Congrats for your easy plugin system btw! It took almost no effort to add another context menu and stuff

Thanks for your help, I realized it while reading your answer.

Just some other question: When I compile a plugin on ubuntu 64bits. Should it run on other linux distributions like arch linux as well?
User avatar
eranif
CodeLite Plugin
Posts: 6375
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Can't open a dialog from custom plugin

Post by eranif »

underdoeg wrote: When I compile a plugin on ubuntu 64bits. Should it run on other linux distributions like arch linux as well?
Usually, when I am developing under Linux, I am providing a pre-compiled binaries per distro ( to be more accurate: I am building the codelite's .deb for Ubuntu32/64, while DavidGH is building the packages for OpenSUSE, FC, Redhat and some other distros )

The point is: you will need to build it for each distro, since the version of the various dependencies (wxWidgets, gtk etc) is different per distro.

Eran
Make sure you have read the HOW TO POST thread
Post Reply