Eclipse and Qt [message #1799331] |
Tue, 04 December 2018 21:16 |
Robert Murch Messages: 13 Registered: August 2018 |
Junior Member |
|
|
Eclipse version info:
Eclipse IDE for C/C++ Developers Version: Photon Release (4.8.0) Build id: 20180619-1200 OS: Linux, v.4.15.0-39-generic, x86_64 / gtk 3.18.9 Java version: 1.8.0_191
The project I am working on build's successfully in Eclipse; however, despite that fact every single reference to QT is underlined in red. For example if I highlight one of the references that is underlined Eclipse reports:
Function 'QLatin1String' could not be resolved
How might I go about getting all these "errors" to go away? It's not a huge issue I would just rather Eclipse not freak out every time it sees a reference to Qt.
Is there a library or package I can download or some setup variable I can change?
I tried: Help:InstallNewSoftware and selected --All Available Sites-- for the 'Work With:' box. The list populates but I can't seem to find anything about QT in it.
I also added:
'usr/include/qt4'
'usr/include/qt4/Qt'
'usr/include/qt4/QtCore'
'usr/include/qt4/QtGui'
to Project -> Properties -> Paths and Symbols -> Includes
[Updated on: Tue, 04 December 2018 22:23] Report message to a moderator
|
|
|
Re: Eclipse and Qt [message #1799333 is a reply to message #1799331] |
Wed, 05 December 2018 01:10 |
David Vavra Messages: 1426 Registered: October 2012 |
Senior Member |
|
|
There is an Indexer which keeps track of symbol definitions during editing.
It is independent of the creation of makefiles.
It reads the source files and included headers.
It needs to know where to look for included headers.
The dialogs controlling this are found at
Project --> Properties --> C/C++ General --> Preprocessor Include Paths, Macros, etc.
On the Entries tab, there are several items.
The only one you can change is called CDT User Setting Entries.
There you can add paths to be searched and also macro definitions.
The other entries are built by providers found on the Providers tab
Note: CDT User Setting Entries are enabled by default.
The most common one supplies the compiler builtins for include paths and macro.
Others you may find helpful:
o) The Build Output Parser reads the build log and finds the include paths and macro definitions used during a compile.
Since your code builds, you can turn on this provider and may not need any other
o) CDT Managed Build Setting Entries reads the definitions and paths found in
Project --> Properties --> C/C++ General --> Paths and Symbols
and gives them to the Indexer.
The entries can be different for each build configuration and each compiler.
You can specify [ All Configurations ]
But you must duplicate entries for each compiler used.
The include paths you listed in your post are likely incorrect for
Project --> Properties --> C/C++ General --> Paths and Symbols --> Includes
They should be absolute paths.
usr/include/qt4 is a relative path.
It probably should be /usr/include/qt4 forr Linux and Posix.
After adding paths to the Indexer search list, you may need to rebuild the Index.
Project --> C/C++ Index --> Rebuild
[Updated on: Wed, 05 December 2018 01:28] Report message to a moderator
|
|
|
Re: Eclipse and Qt [message #1799366 is a reply to message #1799333] |
Wed, 05 December 2018 17:21 |
Robert Murch Messages: 13 Registered: August 2018 |
Junior Member |
|
|
@David Vavra First of all, thanks for trying to help me. So I did what you suggested and changed the paths from relative to absolute. Also, I 'Enabled project specific settings' @ Project --> Properties --> C/C++ General --> Indexer. I ran a rebuild @ Project --> C/C++ Index --> Rebuild. I wasn't sure if you wanted me to change anything @ Project --> Properties --> C/C++ General --> Preprocessor Include Paths, Macros --> Providers, but I enabled CDT Libtool GCC Build Output Parser and CDT Managed Build Settings Entries was already enabled.
After the steps above and a full rebuild the problem persisted so I shut down eclipse and reopened it and what do you know there were no more problems but as soon as I ran a full build again I got an error:
"Errors occurred during the build. Errors running builder 'CDT Builder' on project 'LonePeak'. java.lang.NullPointerException"
and the problem came back. I tried a full build again and there was no error. and it reports: Build Finished. 0 errors, 1 warnings (this is repeatable) but the problem still persists.
So I shutdown Eclipse again and reopened it and before I tried building @ Project --> Properties --> C/C++ General --> Preprocessor Include Paths, Macros --> Providers, I clicked 'Restore Defaults' I ran a full build and got the error again. So, I am really not sure where this error is coming from. I have noticed something (not sure if its new) @ Project -> Properties -> Paths and Symbols -> Includes --> GNU C++ highlighting any of my includes there is a warning message at the bottom:
"The selected folder does not exist or not accessible."
This all just seems rather odd. I can get it to build with 0 errors, 1 warnings. in the Console window but if I look at the problems window it says:
255 Errors, 5 warnings, 0 others (filter matched 105 of 260 items)
How can it be both building with no errors and be reporting 260 semantic errors at the same time???
Also, those warnings are:
Invalid project path: Include path not found (usr/include/qt4)
Invalid project path: Include path not found (usr/include/qt4/Qt)
Invalid project path: Include path not found (usr/include/qt4/QtCore)
Invalid project path: Include path not found (usr/include/qt4/QtGui)
[Updated on: Wed, 05 December 2018 17:27] Report message to a moderator
|
|
|
Re: Eclipse and Qt [message #1799380 is a reply to message #1799366] |
Wed, 05 December 2018 20:10 |
David Vavra Messages: 1426 Registered: October 2012 |
Senior Member |
|
|
It looks like you are still using a relative path usr/include
Instead of an absolute one /usr/include
The indexer will try to search from Eclipse's working directory.
I doubt that will work.
UPDATE
There are two things at work:
The compiler initiated by make, and
The indexer amd codan.
The errors aren't compile errors
Also, some things in the problem window are sticky.
You can delete the warnings and errors to see if they return.
[Updated on: Wed, 05 December 2018 20:18] Report message to a moderator
|
|
|
Re: Eclipse and Qt [message #1799383 is a reply to message #1799380] |
Wed, 05 December 2018 21:04 |
Robert Murch Messages: 13 Registered: August 2018 |
Junior Member |
|
|
I swear to the good lord that I changed it to a full path... apparently not because I just tried changing it again and now it seems to be working.
If it breaks again I will come back but for now I will consider this problem solved.
Thanks guys!
EDIT: The only one still giving me problems is QHBoxLayout and QVBoxLayout but I can deal with that.
[Updated on: Wed, 05 December 2018 21:17] Report message to a moderator
|
|
|
Powered by
FUDForum. Page generated in 0.03244 seconds