Hi,
attached here 2 files:
1. project/workspace. the CodeLite workspace is under RandomNumbersFsm\RN folder.
2. picture of the error message.
I put here a link to the article that I wrote in codeproject, in case an explanation for the code is needed. Generic Finite State Machine (FSM). If you want compile the VS version of the project you should download the one from the codeproject. the VS project that is attached here is crippled!
I'm getting code completion error when trying access methods in a project where I use clang as the parser (with ctags it is totally different story see ahead).
The project is portable (as far as I know) and was compiled under Visual Studio and gcc successfully.
In Visual Studio and Code::Blocks I get good completion, of course with slight changes between the two. The most important thing is that I had the code completion on both of them.
With CodeLite, however, I get no support for code completion when using the operator->(). for example try to use different method for NumbersGeneratorFsm->Generate(); in the file RandomNumbersFsm.cpp. you may use the method Stop() if you want.
switching to clang parsing in CodeLite brings the error.
If any of you is a guru in clang I would really appreciate the help.
It is important for me to be able to use CodeLite, because so far it is the easiest for me and other people to migrate from VS to more portable environment.
Thanks in advance
code completion error
-
- CodeLite Curious
- Posts: 3
- Joined: Wed Sep 05, 2012 12:22 am
- Genuine User: Yes
- IDE Question: c++
- Contact:
code completion error
You do not have the required permissions to view the files attached to this post.
- eranif
- CodeLite Plugin
- Posts: 6375
- Joined: Wed Feb 06, 2008 9:29 pm
- Genuine User: Yes
- IDE Question: C++
- Contact:
Re: code completion error
If clang can not complete, it means that the code can not be compiled.
I tried to compile your code with clang++ instead of g++:
To my understanding it seems to me that this code indeed should not be compiled and clang is correct refusing to compile it:
From the c++ standard http://www.open-std.org/jtc1/sc22/wg21/ ... plate.html:
I tried to compile your code with clang++ instead of g++:
Code: Select all
codelitegcc clang++ -c "C:/Users/eran/Desktop/RandomNumbersFsm/NumbersGenerator.cpp" -g -Wall -std=gnu++0x -O0 -o ./Debug/RandomNumbersFsm_NumbersGenerator.o -Ic:/mingw-4.6.1/lib/gcc/mingw32/4.6.1/include/c++ -Ic:/mingw-4.6.1/lib/gcc/mingw32/4.6.1/include/c++/mingw32 -Ic:/mingw-4.6.1/lib/gcc/mingw32/4.6.1/include/c++/backward -Ic:/mingw-4.6.1/lib/gcc/mingw32/4.6.1/include -Ic:/mingw-4.6.1/include -Ic:/mingw-4.6.1/lib/gcc/mingw32/4.6.1/include-fixed -I. -I.
codelitegcc clang++ -c "C:/Users/eran/Desktop/RandomNumbersFsm/RandomNumbersFsm.cpp" -g -Wall -std=gnu++0x -O0 -o ./Debug/RandomNumbersFsm_RandomNumbersFsm.o -Ic:/mingw-4.6.1/lib/gcc/mingw32/4.6.1/include/c++ -Ic:/mingw-4.6.1/lib/gcc/mingw32/4.6.1/include/c++/mingw32 -Ic:/mingw-4.6.1/lib/gcc/mingw32/4.6.1/include/c++/backward -Ic:/mingw-4.6.1/lib/gcc/mingw32/4.6.1/include -Ic:/mingw-4.6.1/include -Ic:/mingw-4.6.1/lib/gcc/mingw32/4.6.1/include-fixed -I. -I.
In file included from C:/Users/eran/Desktop/RandomNumbersFsm/NumbersGenerator.cpp:2:
In file included from C:/Users/eran/Desktop/RandomNumbersFsm/NumbersGenerator.h:2:
C:/Users/eran/Desktop/RandomNumbersFsm/fsm.h:187:25: error: non-type template argument depends on a template parameter of the partial specialization
struct StateHandler<static_cast<States>(0), DummyExplicitSpecialization>
^~~~~~~~~~~~~~~~~~~~~~
1 error generated.
In file included from C:/Users/eran/Desktop/RandomNumbersFsm/RandomNumbersFsm.cpp:5:
In file included from C:/Users/eran/Desktop/RandomNumbersFsm/NumbersGenerator.h:2:
From the c++ standard http://www.open-std.org/jtc1/sc22/wg21/ ... plate.html:
Eran5 Within the argument list of a class template partial specialization,
the following restrictions apply:
--A partially specialized non-type argument expression shall not
involve a template parameter of the specialization. [Example:
template <int I, int J> struct B {};
template <int I> struct B<I, I*2> {}; // error
--end example]
--The type of a specialized argument shall not be dependent on another
parameter of the specialization. [Example:
template <class T, T t> struct C {};
template <class T> struct C<T, 1>; // error
--end example]
--The argument list of the specialization shall not be identical to
the implicit argument list of the primary template.
Make sure you have read the HOW TO POST thread
-
- CodeLite Curious
- Posts: 3
- Joined: Wed Sep 05, 2012 12:22 am
- Genuine User: Yes
- IDE Question: c++
- Contact:
Re: code completion error
In that case how do I integrate clang as a compiler instead of gcc/g++ in CodeLite?eranif wrote:If clang can not complete, it means that the code can not be compiled.
.
:
Eran
It would be great if you post some kind of configuration that should be or a link to a place with instruction. That way I'll be able to fix it myself.
Thanks
- eranif
- CodeLite Plugin
- Posts: 6375
- Joined: Wed Feb 06, 2008 9:29 pm
- Genuine User: Yes
- IDE Question: C++
- Contact:
Re: code completion error
Under Windows, its a problem.
Mainly because the code can not be debugged (wrong DW debug info is produced)
If you dont need debugging, then intergrating clang is easy
I already reported this bug to clang community:
http://llvm.org/bugs/show_bug.cgi?id=13636
Under Linux, its a different story:
You can compile clang yourself (not as scary as it shound, I am doing it on a weekly basis)
The steps are:
1) Compile clang - follow this article on codelite's wiki: http://www.codelite.org/Developers/HomePage#toc2, once the installation is done, run "sudo make install", or alternatively download clang for your Linux box from
here: http://llvm.org/releases/download.html#3.1, add clang 'bin' directory to the PATH environment variable
2) Next, define clang as a compiler in codelite:
From the main menu:
Settings -> Build Settings -> New Compiler
name it "clang"
codelite will create a clone for 'g++'
now, update the tool-chain:
"Settings -> Build Settings -> Compilers -> clang"
Replace all instances of "g++" -> "clang++"
and all instances of "gcc" -> "clang"
Create new template console application for clang:
- Create a new console project (g++)
- Open the project settings -> general and replace the compiler from "gnu g++" -> "clang"
- Right click on the project and select "Save as template" - from now on you will have a new "hello world" template for clang
Test it:
Hit F7 to build
Under linux, codelite's gdb plugin can debug the code without any problem
Eran
Mainly because the code can not be debugged (wrong DW debug info is produced)
If you dont need debugging, then intergrating clang is easy
I already reported this bug to clang community:
http://llvm.org/bugs/show_bug.cgi?id=13636
Under Linux, its a different story:
You can compile clang yourself (not as scary as it shound, I am doing it on a weekly basis)
The steps are:
1) Compile clang - follow this article on codelite's wiki: http://www.codelite.org/Developers/HomePage#toc2, once the installation is done, run "sudo make install", or alternatively download clang for your Linux box from
here: http://llvm.org/releases/download.html#3.1, add clang 'bin' directory to the PATH environment variable
2) Next, define clang as a compiler in codelite:
From the main menu:
Settings -> Build Settings -> New Compiler
name it "clang"
codelite will create a clone for 'g++'
now, update the tool-chain:
"Settings -> Build Settings -> Compilers -> clang"
Replace all instances of "g++" -> "clang++"
and all instances of "gcc" -> "clang"
Create new template console application for clang:
- Create a new console project (g++)
- Open the project settings -> general and replace the compiler from "gnu g++" -> "clang"
- Right click on the project and select "Save as template" - from now on you will have a new "hello world" template for clang
Test it:
Hit F7 to build
Under linux, codelite's gdb plugin can debug the code without any problem
Eran
Make sure you have read the HOW TO POST thread
- Jarod42
- CodeLite Expert
- Posts: 240
- Joined: Wed Sep 30, 2009 5:54 pm
- Genuine User: Yes
- IDE Question: C++
- Location: France
- Contact:
Re: code completion error
Once you get clang compiler.
In menu
Settings -> Build Settings...
Compiler Tab: Create new compiler: New...
And complete the different fields.
Note: you may copy include from Tags Settings... -> ctags : Include Files into "clang" : advanced : Include Path.
In menu
Settings -> Build Settings...
Compiler Tab: Create new compiler: New...
And complete the different fields.
Note: you may copy include from Tags Settings... -> ctags : Include Files into "clang" : advanced : Include Path.
- eranif
- CodeLite Plugin
- Posts: 6375
- Joined: Wed Feb 06, 2008 9:29 pm
- Genuine User: Yes
- IDE Question: C++
- Contact:
Re: code completion error
Use this wiki page for a complete installation guide of clang under Windows / Linux + setting it up in codelite
http://www.codelite.org/LiteEditor/ClangCompiler
Eran
http://www.codelite.org/LiteEditor/ClangCompiler
Eran
Make sure you have read the HOW TO POST thread
-
- CodeLite Curious
- Posts: 3
- Joined: Wed Sep 05, 2012 12:22 am
- Genuine User: Yes
- IDE Question: c++
- Contact:
Re: code completion error
That is great!
Thank you all
I'll start dealing with clang ASAP
Thank you all
I'll start dealing with clang ASAP