problem with namespaces, need advice

General questions regarding the usage of CodeLite
veldspar
CodeLite Curious
Posts: 8
Joined: Sat Dec 04, 2010 10:55 pm
Genuine User: Yes
IDE Question: C++
Contact:

problem with namespaces, need advice

Post by veldspar »

Hello! I've submitted a bug, but not sure that there is no workaround.
I use codelite 2.8.0.4537 (Windows build) and the following code does not suggest Declaration/Implementation on "Bar":

Code: Select all

#include <stdio.h>

namespace Foo
{
	struct Bar
	{
		int a;
	};
};

using namespace Foo;

int main(int argc, char **argv)
{
	Bar k;                     //but Foo::Bar k; works!!
	k.a = 0;
	printf("hello world\n");
	return 0;
}
If I rightclick Bar and select "Goto Declaration" - nothing happens, but if I write Foo::Bar instead, then everything works just fine.
I have pretty large project with extensive "using namespace", so I'd like to ask if there is any workaround for this issue?
User avatar
eranif
CodeLite Plugin
Posts: 6373
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: problem with namespaces, need advice

Post by eranif »

From what I have tested so far, everything is working expect the 'go to declaration'

I tested this:

Code: Select all

Ba // Ctrl-SPACE suggests 'Bar'

Bar bar;
bar. // Completion is working

Did you encounter another problems or just this?

Also, make sure that you enable this option:
Settings | Tags Settings | Display and Behavior -> Scan all included files to locate 'using namespace' statements

Eran
Make sure you have read the HOW TO POST thread
veldspar
CodeLite Curious
Posts: 8
Joined: Sat Dec 04, 2010 10:55 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: problem with namespaces, need advice

Post by veldspar »

eranif wrote:From what I have tested so far, everything is working expect the 'go to declaration'
Did you encounter another problems or just this?
Eran
So far I found only this problem.
option "Scan all included files to locate 'using namespace' statements" was checked.
code suggestion and code completion work just fine, only "Goto Declaration/Implementation" is not working.
User avatar
eranif
CodeLite Plugin
Posts: 6373
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: problem with namespaces, need advice

Post by eranif »

Thanks, I will look into it, can you please submit it as bug report in sourceforge?
https://sourceforge.net/tracker/?func=a ... tid=979960
Eran
Make sure you have read the HOW TO POST thread
veldspar
CodeLite Curious
Posts: 8
Joined: Sat Dec 04, 2010 10:55 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: problem with namespaces, need advice

Post by veldspar »

eranif wrote:Thanks, I will look into it, can you please submit it as bug report in sourceforge?
https://sourceforge.net/tracker/?func=a ... tid=979960
Eran
As mentioned in first post, the bug report is already submitted, see:
http://sourceforge.net/tracker/?func=de ... tid=979960

Thanks for reply!
veldspar
CodeLite Curious
Posts: 8
Joined: Sat Dec 04, 2010 10:55 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: problem with namespaces, need advice

Post by veldspar »

Hello, Eranif!

Thanks for fixing this bug in new codelite version, but seems, something went wrong and identifier lookup now completely failing INSIDE namespace.
For example:

Code: Select all

#include <stdio.h>

namespace Baz
{
struct Tada
{
    int bar;  
};

class Foo
{
public:
    Tada sad; // Tada cannot be located via Goto Declaration/Implementation
};
} //namespace Baz

int main(int argc, char **argv)
{
	printf("hello world\n");
	return 0;
}
In class Foo, if I try to locate Declaration/Implementation of "Tada" nothing happens :(
User avatar
eranif
CodeLite Plugin
Posts: 6373
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: problem with namespaces, need advice

Post by eranif »

veldspar wrote:Thanks for fixing this bug in new codelite version, but seems, something went wrong and identifier lookup now completely failing INSIDE namespace.
For example:
Should be fixed in the trunk

Eran
Make sure you have read the HOW TO POST thread
veldspar
CodeLite Curious
Posts: 8
Joined: Sat Dec 04, 2010 10:55 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: problem with namespaces, need advice

Post by veldspar »

eranif wrote:
veldspar wrote: Should be fixed in the trunk
Thanks! I tried Codelite from trunk and some of my sources got damaged :lol:
If the source contains cyrillic characters then it will have binary garbage when you save it.

Code: Select all

#include <stdio.h>

int main(int argc, char **argv)
{
	printf("hello world\n");//абв
	return 0;
}
Settings->Global Editor Preferences->Misc->File Font Encoding = WINDOWS-1251
the following example cannot compile because source is damaged (sometimes it can compile with warning "null character(s) ignored")
Codelite embeds some binary data into source, so compilation is not possible.
If the comment //абв is removed, then problem is gone.
Probably, the latest release is also affected
User avatar
eranif
CodeLite Plugin
Posts: 6373
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: problem with namespaces, need advice

Post by eranif »

Please attach a sample source file that I could use to test this.
(copy/paste from the forum will probably won't work)

Eran
Make sure you have read the HOW TO POST thread
veldspar
CodeLite Curious
Posts: 8
Joined: Sat Dec 04, 2010 10:55 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: problem with namespaces, need advice

Post by veldspar »

eranif wrote:Please attach a sample source file that I could use to test this.
(copy/paste from the forum will probably won't work)
Eran
Please, see 3 attached files.
Codelite revision: 4731

Damaged file has 3 extra binary bytes at the end of the file: 0x00 0x05 0x2A
You do not have the required permissions to view the files attached to this post.
Post Reply