Few weird things after moving onto 5.1

General questions regarding the usage of CodeLite
Moonkis
CodeLite Curious
Posts: 7
Joined: Wed Mar 06, 2013 1:36 am
Genuine User: Yes
IDE Question: C++
Contact:

Few weird things after moving onto 5.1

Post by Moonkis »

I made the move from 5.1 some days ago and I'v been noticing some very strange behavior.

Building code with errors will output ( [ALL] ) error messages but the build will say 0 errors, also the red error text is gone.
This is something that is VERY annoying, because of it I often don't recognize when a build fails, I run the program and wonder why my new features isn't implemented.
Is there any way to fix this?

Clang code completion worse.
If I enable Clang-CC I get a LOT of wonky error-thingys. For example this snippet below:

Code: Select all

class Foo
{
public:
    void a(int value) { /* Code */ }
    void print()
    {
        int i = 100;
        a(100); /* <--- This works fine with code-completions, it gives me parameter list. */
        for( int k = 0; k < 10; k++ )
        {
            a(100); /* Here it goes to hell, it tells me clang error, expected } to match this { */
        }
    }
};
Disabling clang makes it work as intended, and there is nothing wrong with the code.

Initializing lists giving me warnings
I'v never seen this before, but seeing as I'v always run with treat all warnings as errors this is QUITE the pain. Whenever I use an initializing list like:

Code: Select all

Foo(int i, int q): m_value(i), m_othervalue(q) {} 
It gives me a warning saying it's intialzed after ( Can't fully quote this ).

SIDE NOTE

How do I cycle through the suggested parameterlist of a function?
Like:
a(int i);
a(char i);

And is there a way to get class member variables to be highlighted inside the function definition in an .cpp file?

I'd also like to take my time saying I really DO enjoy CodeLite, it's awesome, light and I love it!
User avatar
eranif
CodeLite Plugin
Posts: 6373
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Few weird things after moving onto 5.1

Post by eranif »

Moonkis wrote:Building code with errors will output ( [ALL] ) error messages but the build will say 0 errors, also the red error text is gone.
This is something that is VERY annoying, because of it I often don't recognize when a build fails, I run the program and wonder why my new features isn't implemented.
Is there any way to fix this?
Providing the build output, will be nice - otherwise, I can't guess the reason for the error
Moonkis wrote:Initializing lists giving me warnings
I'v never seen this before, but seeing as I'v always run with treat all warnings as errors this is QUITE the pain. Whenever I use an initializing list like:
CODE: SELECT ALL
Foo(int i, int q): m_value(i), m_othervalue(q) {}

It gives me a warning saying it's intialzed after ( Can't fully quote this ).
This is a problem in your code. In C++ the initialization list should reflect the order of the members as they were declared in the header file.
Again, providing the build error would be nice here (I added a small button that allows you to copy the build output directly to the clipboard - please use it
Moonkis wrote:Disabling clang makes it work as intended, and there is nothing wrong with the code.
This is strange, as it works perfectly here ( I copy/paste your sample code ) enabled clang - (both checkboxes) and it worked like a charm
Is the code you provided is the *full* code? or did you omit something?

Make sure you read and follow the guides in the HOW TO POST forum topic, as your post is missing a lot of information

Eran
Make sure you have read the HOW TO POST thread
Moonkis
CodeLite Curious
Posts: 7
Joined: Wed Mar 06, 2013 1:36 am
Genuine User: Yes
IDE Question: C++
Contact:

Re: Few weird things after moving onto 5.1

Post by Moonkis »

CodeLite Version - 5.1
Self Compiled - No, from official source.
OS - Windows 7

Clang fail code (FULL)

Code: Select all

class Foo
{
public:

	void integerPrint(int i)
	{
		std::cout << i << std::endl;
	}
	
	void print(int i)
	{
		integerPrint(i); /* Clang-error but works. */
	}
};

int main(int argc, char **argv)
{
	Foo foo;
	foo.print(100);
	return 0;
}

Building but failing output
C:\Windows\system32\cmd.exe /c "mingw32-make.exe -j 4 -e -f "OneGameAMonth_wsp.mk""
"----------Building project:[ Random_Dungeon_Generation - Debug ]----------"
mingw32-make.exe[1]: Entering directory `C:/Program Files (x86)/CodeLite/OneGameAMonth/Random_Dungeon_Generation'
codelitegcc g++ -c "C:/Program Files (x86)/CodeLite/OneGameAMonth/Random_Dungeon_Generation/main.cpp" -g -O0 -Wall -o ./Debug/main.o -I. -I.
C:/Program Files (x86)/CodeLite/OneGameAMonth/Random_Dungeon_Generation/main.cpp:239:1: error: expected ';' after class definition
mingw32-make.exe[1]: *** [Debug/main.o] Error 1
Random_Dungeon_Generation.mk:95: recipe for target `Debug/main.o' failed
mingw32-make.exe[1]: Leaving directory `C:/Program Files (x86)/CodeLite/OneGameAMonth/Random_Dungeon_Generation'
mingw32-make.exe: *** [All] Error 2
OneGameAMonth_wsp.mk:4: recipe for target `All' failed
0 errors, 0 warnings
Code used:

Code: Select all

class Foo
{
public:

	void integerPrint(int i)
	{
		std::cout << i << std::endl;
	}
	
	void print(int i)
	{
		integerPrint(i);
	}
} /* Lacks ; so it will fail. */

int main(int argc, char **argv)
{
	Foo foo;
	foo.print(100);
	return 0;
}
This is a problem in your code. In C++ the initialization list should reflect the order of the members as they were declared in the header file.
Again, providing the build error would be nice here (I added a small button that allows you to copy the build output directly to the clipboard - please use it
Ah! I'm coming from Visual Studio and C::B and never encountered this before, good to know!

Also if it's not asking to much could you please see the questions in the SIDE NOTE section of the original post.

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

Re: Few weird things after moving onto 5.1

Post by eranif »

Moonkis wrote:Clang fail code (FULL)
CODE: SELECT ALL
class Foo
{
public:

   void integerPrint(int i)
   {
      std::cout << i << std::endl;
   }
   
   void print(int i)
   {
      integerPrint(i); /* Clang-error but works. */
   }
};

int main(int argc, char **argv)
{
   Foo foo;
   foo.print(100);
   return 0;
}
OK, I see what you mean now. If I only type the "(" I get an error from clang. However, if you cancel it (hit ESCAPE) and then hit Ctrl-Shift-SPACE (which is the shortcut for triggering the function tooltip) it works
Another case that works:

type: integer // Hit Ctrl-SPACE and accept the completion
it will also work

This seems like a glitch in clang. In anycase, I strongly recommend to use clang in addition to the built-in parser (the built-in parser will work in 99% of the cases) codelite will only use clang when it fails to parse something using the builtin parser
Read this for more details
Moonkis wrote:Building but failing output
C:\Windows\system32\cmd.exe /c "mingw32-make.exe -j 4 -e -f "OneGameAMonth_wsp.mk""
"----------Building project:[ Random_Dungeon_Generation - Debug ]----------"
mingw32-make.exe[1]: Entering directory `C:/Program Files (x86)/CodeLite/OneGameAMonth/Random_Dungeon_Generation'
codelitegcc g++ -c "C:/Program Files (x86)/CodeLite/OneGameAMonth/Random_Dungeon_Generation/main.cpp" -g -O0 -Wall -o ./Debug/main.o -I. -I.
C:/Program Files (x86)/CodeLite/OneGameAMonth/Random_Dungeon_Generation/main.cpp:239:1: error: expected ';' after class definition
mingw32-make.exe[1]: *** [Debug/main.o] Error 1
Random_Dungeon_Generation.mk:95: recipe for target `Debug/main.o' failed
mingw32-make.exe[1]: Leaving directory `C:/Program Files (x86)/CodeLite/OneGameAMonth/Random_Dungeon_Generation'
mingw32-make.exe: *** [All] Error 2
OneGameAMonth_wsp.mk:4: recipe for target `All' failed
0 errors, 0 warnings
This happens because you placed your sources in a folder with a weird characters ("Program Files (x86)")
Move your sources elsewhere to location without spaces non standard characters in the path and it will work.
Alternatively, you can fix the parsing regex. You will encounter other errors if you insist on placing the sources there (not only from codelite, for example, the windres.exe utility (windows resource compiler) will also break compiling such sources)
Moonkis wrote:Ah! I'm coming from Visual Studio and C::B and never encountered this before, good to know!
You should know that codelite is not a compiler and its gcc which generates these errors/warnings. If you did not get them under C::B it means that you either used VC or used different warning level
Moonkis wrote:How do I cycle through the suggested parameterlist of a function?
Like:
a(int i);
a(char i);
Use the UP/DOWN arrows
Moonkis wrote:And is there a way to get class member variables to be highlighted inside the function definition in an .cpp file?
Try: Settings -> Tags Settings -> General -> Colouring -> Colour workspace tags
and check the option:
"member"

Note that codelite has limitation for 2 colours only: 1 is allocated for local variables and the second is for the rest (the list of checkboxes on that page)
You can change the font, colour style etc from: Settings -> Syntax highlight and Fonts -> C++ -> Customize -> Local Variables ( or Workspace Tags )

Eran
Make sure you have read the HOW TO POST thread
petah
CodeLite Expert
Posts: 231
Joined: Sat Nov 24, 2012 8:04 pm
Genuine User: Yes
IDE Question: c++
Location: Los Angeles
Contact:

Re: Few weird things after moving onto 5.1

Post by petah »

Moonkis wrote:Initializing lists giving me warnings
I'v never seen this before, but seeing as I'v always run with treat all warnings as errors this is QUITE the pain. Whenever I use an initializing list like:

Code: Select all

Foo(int i, int q): m_value(i), m_othervalue(q) {} 
It gives me a warning saying it's intialzed after ( Can't fully quote this ).
That's not CL-related and appeared because gcc was updated. It's a weird gcc warning, afaik it's BS and can be ignored.

I silenced them by moving my initializers to explicit assignments inside the ctors, so gcc still warns about legitimate out-of-order assignments.

-- p
main: Debian Jessie x64 + custom wxTrunk
Post Reply