Page 1 of 2

problem with namespaces, need advice

Posted: Sat Dec 04, 2010 11:12 pm
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?

Re: problem with namespaces, need advice

Posted: Sun Dec 05, 2010 1:02 am
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

Re: problem with namespaces, need advice

Posted: Sun Dec 05, 2010 11:53 am
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.

Re: problem with namespaces, need advice

Posted: Tue Dec 07, 2010 10:57 am
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

Re: problem with namespaces, need advice

Posted: Thu Dec 09, 2010 4:43 pm
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!

Re: problem with namespaces, need advice

Posted: Tue Feb 08, 2011 7:21 pm
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 :(

Re: problem with namespaces, need advice

Posted: Wed Feb 09, 2011 1:55 pm
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

Re: problem with namespaces, need advice

Posted: Fri Feb 11, 2011 8:28 pm
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

Re: problem with namespaces, need advice

Posted: Fri Feb 11, 2011 11:57 pm
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

Re: problem with namespaces, need advice

Posted: Mon Feb 14, 2011 12:42 pm
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