Add function implementation not working

General questions regarding the usage of CodeLite
frank_frl
CodeLite Expert
Posts: 176
Joined: Sun Aug 17, 2008 2:45 pm
Contact:

Add function implementation not working

Post by frank_frl » Tue Aug 19, 2008 3:44 pm

Hi Eran,

when I add a function declaration to a class in the header file, select the function name and the choose 'Add function implementation...' nothing happens at all.

CodeLite rev. 1927, WinXP, SP2

Regards,

Frank

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

Re: Add function implementation not working

Post by eranif » Tue Aug 19, 2008 4:25 pm

Several things:

1. Make sure the file you are using is part of a project
2. Save the fie before attempting to do any 'Code Generation/ Refactoring', if this does not work try to re-tag the workspace (workspace context menu -> retag workspace)

Another question: does 'add all un-implemented functions' - works?

Can u post some code here?

Eran
Make sure you have read the HOW TO POST thread

frank_frl
CodeLite Expert
Posts: 176
Joined: Sun Aug 17, 2008 2:45 pm
Contact:

Re: Add function implementation not working

Post by frank_frl » Tue Aug 19, 2008 7:44 pm

Hi Eran,
1. Make sure the file you are using is part of a project
2. Save the fie before attempting to do any 'Code Generation/ Refactoring', if this does not work try to re-tag the workspace (workspace context menu -> retag workspace)
I did that.

For test purpose I created a wxWidgets project with your wizard. The I added 2 functions declarations to the header e.g.

Code: Select all

#ifndef __TestbuildFrame__
#define __TestbuildFrame__

#include "wx/frame.h"

class TestbuildFrame : public wxFrame {

private:
	void Initialize();
	void CreateMenuBar();

	void TestFunction();   
	void TestFoo();

public:
	TestbuildFrame(wxWindow* parent,
            wxWindowID id,
            const wxString& title,
            const wxPoint& pos = wxDefaultPosition,
            const wxSize& size = wxDefaultSize,
            long style = wxDEFAULT_FRAME_STYLE | wxSUNKEN_BORDER);

	~TestbuildFrame();
	DECLARE_EVENT_TABLE()
	
	void OnClose(wxCloseEvent &e);
	void OnQuit(wxCommandEvent &e);
	
};
#endif // __TestbuildFrame__
For 'TestFunction()' function implementation works, but for 'TestFoo()' not. When choose 'Implement all Un-implemented' they appear both.

Regards,

Frank

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

Re: Add function implementation not working

Post by eranif » Tue Aug 19, 2008 8:55 pm

mm, I did this:
- create new wxwidgets project using the wizard
- copy pasted the 2 declarations of TestFoo() and TestFunction (and saved the file)
- right click on the function name TestFunction() and select 'add function implementation' - worked
- right click on the function name TestFoo() and select 'add function implementation' - worked

Are these the exact steps you did?
Maybe one last guess: When u go 'Settings -> Tags Settings..' In the 'Basics' tab, do you have 'Cache workspace tags' enabled? (if it is enabled, please turn it off)

this is my header file:

Code: Select all

#ifndef __IuuyFrame__
#define __IuuyFrame__

#include "wx/frame.h"

class IuuyFrame : public wxFrame {

private:
	void Initialize();
	void CreateMenuBar();
	
	void TestFunction();   
	void TestFoo();
	
public:
	IuuyFrame(wxWindow* parent,
            wxWindowID id,
            const wxString& title,
            const wxPoint& pos = wxDefaultPosition,
            const wxSize& size = wxDefaultSize,
            long style = wxDEFAULT_FRAME_STYLE | wxSUNKEN_BORDER);

	~IuuyFrame();
	DECLARE_EVENT_TABLE()
	
	void OnClose(wxCloseEvent &e);
	void OnQuit(wxCommandEvent &e);
	
};
#endif // __IuuyFrame__
Eran
Make sure you have read the HOW TO POST thread

frank_frl
CodeLite Expert
Posts: 176
Joined: Sun Aug 17, 2008 2:45 pm
Contact:

Re: Add function implementation not working

Post by frank_frl » Tue Aug 19, 2008 10:20 pm

Hi Eran,

the problem in my project was, that I didn't had all headers in the project tree. If you open a header just by 'swap source - header' and save it than, it is not re-tagged, you have to force it than to get function implementation working.

The reason why it didn't worked in the sample frame might have been the 'cache workspace tags' setting, I could not reproduce it again.

Thanks for your fast reply,

Frank

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

Re: Add function implementation not working

Post by eranif » Tue Aug 19, 2008 10:43 pm

frank_frl wrote:The reason why it didn't worked in the sample frame might have been the 'cache workspace tags' setting
This one will not be a problem anymore, I improved the performance of the tags so it is no longer needed and in the current trunk (rev2003) it is disabled and can not be turned on again.

Only files which are part of the workspace are retagged (tagging is done automatically once the file is saved) the re-tag is a more of a backup system nothing more, and normally you should not force retagging on file(s)

Glad to hear that it is working OK for you now - let me know if you encounter any other oddities.
Eran
Make sure you have read the HOW TO POST thread

Post Reply