[Qt-creator] Code completion doesn't work with ClangCodeModel
Bernhard Seßler
bernhard.sessler at corscience.de
Tue Jan 14 09:47:51 CET 2014
Hi,
as far as I can see, you've got another problem: the binaries from
qt-project.org were configured with the -reduce-relocations switch (and thus
build with the -fPIC compiler switch), which means that your executable /
library also must be compiled with position independent code activated (see:
http://en.wikipedia.org/wiki/Position-independent_code).
All in all it's just adding the -fPIE (when building an executable) or -fPIC
command line switch (when building a library) to the compiler arguments (in case
you're using gcc).
E.g. using CMake as build system (>= 2.8.9), it's as simple as:
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
to enable generating position independent code for all top level targets, or
set_target_properties(<target> PROPERTIES POSITION_INDEPENDENT_CODE ON)
to enable it only for the given <target>.
Regards,
Bernhard
On 14.01.2014 01:56, Yang Fan wrote:
> Hi,
>
> I have dumpped the error messages, seemly it's caused by the Qt 5.2
> binaries. I'm using the binaries downloaded from
> http://qt-project.org/downloads.
>
> *** Reparse for highlighting took 481 ms.
> "error" "/home/tvu/Qt5.2.0/5.2.0/gcc_64/include/QtCore/qglobal.h"
> [996:4(33790)] ""You must build your code with position independent code if
> Qt was built with -reduce-relocations. " "Compile your code with
> -fPIC or -fPIE."
> in file included from /home/tvu/Shareware/istkani/src/main.cpp:1:
> in file included from /home/tvu/Shareware/istkani/src/main.cpp:1:
> in file included from
> /home/tvu/Qt5.2.0/5.2.0/gcc_64/include/QtWidgets/QApplication:1:
> in file included from
> /home/tvu/Qt5.2.0/5.2.0/gcc_64/include/QtWidgets/qapplication.h:45:
> in file included from
> /home/tvu/Qt5.2.0/5.2.0/gcc_64/include/QtCore/qcoreapplication.h:45:"
> "error" "/opt/intel/composer_xe_2013.0.079/compiler/include/math.h"
> [27:3(742)] ""This Intel <math.h> is for use with only the Intel compilers!"
> in file included from /home/tvu/Shareware/istkani/src/main.cpp:1:
> in file included from /home/tvu/Shareware/istkani/src/main.cpp:4:
> in file included from
> /home/tvu/Qt5.2.0/5.2.0/gcc_64/include/QtQml/QtQml:3:
> in file included from
> /home/tvu/Qt5.2.0/5.2.0/gcc_64/include/QtQml/QtQmlDepends:2:
> in file included from
> /home/tvu/Qt5.2.0/5.2.0/gcc_64/include/QtCore/QtCore:65:
> in file included from
> /home/tvu/Qt5.2.0/5.2.0/gcc_64/include/QtCore/qmath.h:49:"
> "error" "/home/tvu/Shareware/istkani/src/main.cpp" [46:5(1373)] "no member
> named 'QDir' in 'QFont'"
> "error" "/home/tvu/Shareware/istkani/src/main.cpp" [57:10(1716)] "use of
> undeclared identifier 'dir'; did you mean 'div'?
> 'div' declared here"
> "error" "/home/tvu/Shareware/istkani/src/main.cpp" [57:10(1716)] "member
> reference base type 'div_t (int, int) throw()' is not a structure or union"
> "error" "/home/tvu/Shareware/istkani/src/main.cpp" [57:14(1720)] "member
> reference base type 'div_t (int, int) throw()' is not a structure or union"
> "error" "/home/tvu/Shareware/istkani/src/main.cpp" [59:9(1792)] "use of
> undeclared identifier 'dir'; did you mean 'div'?
> 'div' declared here"
> "error" "/home/tvu/Shareware/istkani/src/main.cpp" [59:9(1792)] "member
> reference base type 'div_t (int, int) throw()' is not a structure or union"
> "error" "/home/tvu/Shareware/istkani/src/main.cpp" [59:13(1796)] "member
> reference base type 'div_t (int, int) throw()' is not a structure or union"
> "error" "/home/tvu/Shareware/istkani/src/main.cpp" [60:9(1812)] "use of
> undeclared identifier 'dir'; did you mean 'div'?
> 'div' declared here"
> "error" "/home/tvu/Shareware/istkani/src/main.cpp" [60:9(1812)] "member
> reference base type 'div_t (int, int) throw()' is not a structure or union"
> "error" "/home/tvu/Shareware/istkani/src/main.cpp" [60:13(1816)] "member
> reference base type 'div_t (int, int) throw()' is not a structure or union"
> "error" "/home/tvu/Shareware/istkani/src/main.cpp" [61:28(1872)] "use of
> undeclared identifier 'dir'; did you mean 'div'?
> 'div' declared here"
> "error" "/home/tvu/Shareware/istkani/src/main.cpp" [61:28(1872)] "member
> reference base type 'div_t (int, int) throw()' is not a structure or union"
> "error" "/home/tvu/Shareware/istkani/src/main.cpp" [61:32(1876)] "member
> reference base type 'div_t (int, int) throw()' is not a structure or union"
> *** Highlighting took 491 ms in total.
> *** Fast re-indexing took 0 ms in total.
> /home/tvu/Qt5.2.0/5.2.0/gcc_64/include/QtCore/qglobal.h:996:4: error: "You
> must build your code with position independent code if Qt was built with
> -reduce-relocations. " "Compile your code with -fPIC or -fPIE."
> /opt/intel/composer_xe_2013.0.079/compiler/include/math.h:27:3: error:
> "This Intel <math.h> is for use with only the Intel compilers!"
> /home/tvu/Shareware/istkani/src/main.cpp:48:5: error: no member named
> 'QDir' in 'QFont'
> /home/tvu/Shareware/istkani/src/main.cpp:57:10: error: use of undeclared
> identifier 'dir'
> /home/tvu/Shareware/istkani/src/main.cpp:59:9: error: use of undeclared
> identifier 'dir'
> /home/tvu/Shareware/istkani/src/main.cpp:60:9: error: use of undeclared
> identifier 'dir'
> /home/tvu/Shareware/istkani/src/main.cpp:61:28: error: use of undeclared
> identifier 'dir'
> ... Completion done in 3313 ms, with 146 items.
>
>
>
> On Mon, Jan 13, 2014 at 6:07 PM, Erik Verbruggen
> <erik.verbruggen at digia.com>wrote:
>
>> On 11-1-2014 3:07, Yang Fan wrote:
>> > Hi,
>> >
>> > I have built the ClangCodeModel plugin successfully with Qt5.2 on Mac OS
>> > X 10.9 and on Debian Wheezy, but after I enabled the plugin and selected
>> > the Code Model in Preference dialog, the code completion feature doesn't
>> > work. When I typed a dot follows an object name, no candidate list
>> > appears. Any suggestion?
>>
>> Can you run with the environment variable QTC_CLANG_VERBOSE set (value
>> doesn't matter), and check stdout? That should show the libclang
>> invocations plus any errors while parsing.
>>
>> -- Erik.
>>
>> _______________________________________________
>> Qt-creator mailing list
>> Qt-creator at qt-project.org
>> http://lists.qt-project.org/mailman/listinfo/qt-creator
>>
>
>
>
>
>
> _______________________________________________
> Qt-creator mailing list
> Qt-creator at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/qt-creator
>
More information about the Qt-creator
mailing list