Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » How to get code completion (MacOS eclipse CDT)(Eclipse Configuration)
How to get code completion (MacOS eclipse CDT) [message #661057] Tue, 22 March 2011 23:27 Go to next message
MauPaz  is currently offline MauPaz Friend
Messages: 6
Registered: March 2011
Junior Member
please I need help with code completion in eclipse mac....
I already have everything works fine except code completion....

I need the right path to find the file that make that work....

Its only with QT API, c++ completion works fine


I work with Snow Leopard, Eclipse Helios and QT 4.7

thanks U.....
Re: How to get code completion (MacOS eclipse CDT) [message #661091 is a reply to message #661057] Wed, 23 March 2011 07:01 Go to previous messageGo to next message
Axel Mueller is currently offline Axel MuellerFriend
Messages: 1973
Registered: July 2009
Senior Member
You must add the Qt include path for the indexer.
Project Properties > C/C++ ->Include Paths and Symbols


Before you ask
- search this forum
- see the FAQ http://wiki.eclipse.org/CDT/User/FAQ
- google
Re: How to get code completion (MacOS eclipse CDT) [message #661293 is a reply to message #661091] Thu, 24 March 2011 01:01 Go to previous messageGo to next message
MauPaz  is currently offline MauPaz Friend
Messages: 6
Registered: March 2011
Junior Member
Axel Mueller wrote on Wed, 23 March 2011 03:01
You must add the Qt include path for the indexer.
Project Properties > C/C++ ->Include Paths and Symbols




Thanks Axel but I already do that and nothing happens...

I go to Project Properties > C/C++ ->Include Paths and Symbols and add

/Library/Frameworks/QtGui.framework/Headers
/Library/Frameworks/QtCore.framework/Headers

Any clue??

Re: How to get code completion (MacOS eclipse CDT) [message #661306 is a reply to message #661293] Thu, 24 March 2011 06:55 Go to previous messageGo to next message
Yevgeny Shifrin is currently offline Yevgeny ShifrinFriend
Messages: 208
Registered: July 2009
Senior Member
* Did you try to re-index your project (select your project->context menu->index->rebuild)?
* Do you have unresolved includes(select your project->context menu->index->Search for Unresolved Includes)?
Re: How to get code completion (MacOS eclipse CDT) [message #661314 is a reply to message #661293] Thu, 24 March 2011 07:57 Go to previous messageGo to next message
Axel Mueller is currently offline Axel MuellerFriend
Messages: 1973
Registered: July 2009
Senior Member
MauPaz wrote on Thu, 24 March 2011 02:01
Axel Mueller wrote on Wed, 23 March 2011 03:01
You must add the Qt include path for the indexer.
Project Properties > C/C++ ->Include Paths and Symbols




Thanks Axel but I already do that and nothing happens...

I go to Project Properties > C/C++ ->Include Paths and Symbols and add

/Library/Frameworks/QtGui.framework/Headers
/Library/Frameworks/QtCore.framework/Headers

Any clue??



Did you add the include paths to C++ language or only C?


Before you ask
- search this forum
- see the FAQ http://wiki.eclipse.org/CDT/User/FAQ
- google
Re: How to get code completion (MacOS eclipse CDT) [message #661499 is a reply to message #661306] Thu, 24 March 2011 23:18 Go to previous messageGo to next message
MauPaz  is currently offline MauPaz Friend
Messages: 6
Registered: March 2011
Junior Member
Yevgeny Shifrin wrote on Thu, 24 March 2011 02:55
* Did you try to re-index your project (select your project->context menu->index->rebuild)?
* Do you have unresolved includes(select your project->context menu->index->Search for Unresolved Includes)?


thanks Yevgeny.....

I did what U say when, I rebuild nothing happens, and the code completion is nule but when I search for unresolved includes the search throw this:

/Library/Frameworks/QtGui.framework/Versions/4/Headers

qapplication.h
Unresolved inclusion: QtCore/qcoreapplication.h
Unresolved inclusion: QtCore/qpoint.h
Unresolved inclusion: QtCore/qsize.h
Unresolved inclusion: QtGui/qcursor.h
Unresolved inclusion: QtGui/qwindowdefs.h

qboxlayout.h
Unresolved inclusion: QtGui/qlayout.h

qslider.h
Unresolved inclusion: QtGui/qabstractslider.h

qspinbox.h
Unresolved inclusion: QtGui/qabstractspinbox.h


and my code is this:

//////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////// //////////
#include<QApplication>
#include<QHBoxLayout>
#include<QSlider>
#include<QSpinBox>


int main(int argc, char* argv[])
{
QApplication app(argc, argv);
QWidget* ventana=new QWidget;
ventana->setWindowTitle("Ejemplo Basico 1");
QSpinBox* spinBox=new QSpinBox;
QSlider* slider=new QSlider(Qt::Horizontal);
spinBox->setRange(0,130);

slider->setRange(0,130);

QObject::connect(spinBox, SIGNAL(valueChanged(int)), slider, SLOT(setValue(int)));

QObject::connect(slider, SIGNAL(valueChanged(int)), spinBox, SLOT(setValue(int)));

spinBox->setValue(35);

QHBoxLayout* layout=new QHBoxLayout;
layout->addWidget(spinBox);
layout->addWidget(slider);

ventana->setLayout(layout);
ventana->show();
return app.exec();

}

//////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////// //////////


thank You again
Re: How to get code completion (MacOS eclipse CDT) [message #661500 is a reply to message #661314] Thu, 24 March 2011 23:20 Go to previous messageGo to next message
MauPaz  is currently offline MauPaz Friend
Messages: 6
Registered: March 2011
Junior Member
Axel Mueller wrote on Thu, 24 March 2011 03:57
MauPaz wrote on Thu, 24 March 2011 02:01
Axel Mueller wrote on Wed, 23 March 2011 03:01
You must add the Qt include path for the indexer.
Project Properties > C/C++ ->Include Paths and Symbols




Thanks Axel but I already do that and nothing happens...

I go to Project Properties > C/C++ ->Include Paths and Symbols and add

/Library/Frameworks/QtGui.framework/Headers
/Library/Frameworks/QtCore.framework/Headers

Any clue??



Did you add the include paths to C++ language or only C?



Im working with C++ but yes... I include paths in C, C++ and nothing happens

Thank U
Re: How to get code completion (MacOS eclipse CDT) [message #661528 is a reply to message #661499] Fri, 25 March 2011 07:10 Go to previous messageGo to next message
Axel Mueller is currently offline Axel MuellerFriend
Messages: 1973
Registered: July 2009
Senior Member
MauPaz wrote on Fri, 25 March 2011 00:18

but when I search for unresolved includes the search throw this:
/Library/Frameworks/QtGui.framework/Versions/4/Headers


But you added
/Library/Frameworks/QtGui.framework/Headers


Where are the actual header files? Are they in subdirectories? Then you have to include them as well.


Before you ask
- search this forum
- see the FAQ http://wiki.eclipse.org/CDT/User/FAQ
- google
Re: How to get code completion (MacOS eclipse CDT) [message #661592 is a reply to message #661528] Fri, 25 March 2011 14:06 Go to previous messageGo to next message
Michael Jackson is currently offline Michael JacksonFriend
Messages: 28
Registered: July 2009
Junior Member
On 3/25/11 3:10 AM, in article imheod$h31$1@news.eclipse.org, "Axel Mueller"
wrote:

> MauPaz wrote on Fri, 25 March 2011 00:18
>> but when I search for unresolved includes the search throw this:
>> /Library/Frameworks/QtGui.framework/Versions/4/Headers
>
> But you added
> /Library/Frameworks/QtGui.framework/Headers
>
> Where are the actual header files? Are they in subdirectories? Then you have
> to include them as well.

So here is the problem. Qt uses the include form like the following:

#include <QtGui/QButton>

which means the compiler is looking for that exact path somewhere in all
the -I flags. The issue is with the frameworks that Qt produces. Taking the
example include from above and the paths we have the following:

/Library/Frameworks/QtGui.framework/Versions/4/Headers/QButt on
/Library/Frameworks/QtGui.framework/Headers/QButton

Which does NOT match any of the Include paths that CDT is looking at. Now
GCC understands that when you have the -FQtGui.framework that include paths
such as

#include <QtGui/QButton> are really of the form
/Library/Frameworks/QtGui.framework/Headers/QButton and thus your code
compiles.

There are 2 ways to fix this issue. One the user can fix then other the CDT
devs can fix.

User: Recompile Qt yourself and install it into your favorite location. The
compilation will generate Frameworks BUT it will also create the traditional
UNIX style directory setup with $QTDIR/include/QtGui which will have the
QButton header file. This will allow CDT to correctly parse the headers and
give you code completion for Qt projects assuming your project has the
-I$QTDR/include as part of its invocation. I use this approach every day for
the last 3 years or so and it works just fine.

CDT: Patch the scanner discovery parser code to understand -F and OS X
Frameworks and make all of the above "just work". Since OS X compatibility
has usually been fairly low on the priority list for CDT devs I always opt
for fix #1.

Hope this all helps.
Mike Jackson
Www.bluequartz.net
Re: How to get code completion (MacOS eclipse CDT) [message #661742 is a reply to message #661592] Sun, 27 March 2011 03:28 Go to previous messageGo to next message
MauPaz  is currently offline MauPaz Friend
Messages: 6
Registered: March 2011
Junior Member
Michael Jackson wrote on Fri, 25 March 2011 10:06
On 3/25/11 3:10 AM, in article imheod$h31$1@news.eclipse.org, "Axel Mueller"
wrote:

> MauPaz wrote on Fri, 25 March 2011 00:18
>> but when I search for unresolved includes the search throw this:
>> /Library/Frameworks/QtGui.framework/Versions/4/Headers
>
> But you added
> /Library/Frameworks/QtGui.framework/Headers
>
> Where are the actual header files? Are they in subdirectories? Then you have
> to include them as well.

So here is the problem. Qt uses the include form like the following:

#include <QtGui/QButton>

which means the compiler is looking for that exact path somewhere in all
the -I flags. The issue is with the frameworks that Qt produces. Taking the
example include from above and the paths we have the following:

/Library/Frameworks/QtGui.framework/Versions/4/Headers/QButt on
/Library/Frameworks/QtGui.framework/Headers/QButton

Which does NOT match any of the Include paths that CDT is looking at. Now
GCC understands that when you have the -FQtGui.framework that include paths
such as

#include <QtGui/QButton> are really of the form
/Library/Frameworks/QtGui.framework/Headers/QButton and thus your code
compiles.

There are 2 ways to fix this issue. One the user can fix then other the CDT
devs can fix.

User: Recompile Qt yourself and install it into your favorite location. The
compilation will generate Frameworks BUT it will also create the traditional
UNIX style directory setup with $QTDIR/include/QtGui which will have the
QButton header file. This will allow CDT to correctly parse the headers and
give you code completion for Qt projects assuming your project has the
-I$QTDR/include as part of its invocation. I use this approach every day for
the last 3 years or so and it works just fine.

CDT: Patch the scanner discovery parser code to understand -F and OS X
Frameworks and make all of the above "just work". Since OS X compatibility
has usually been fairly low on the priority list for CDT devs I always opt
for fix #1.

Hope this all helps.
Mike Jackson
Www.bluequartz.net



Thank U very much man for your time....


I did what U say... Now I have all the files in the

/usr/local/Trolltech/Qt-4.4.7/

So i include the file directory but i can't find the <QtGui/QButton> file.... and i have no code completion yet







Re: How to get code completion (MacOS eclipse CDT) [message #661743 is a reply to message #661742] Sun, 27 March 2011 03:35 Go to previous messageGo to next message
MauPaz  is currently offline MauPaz Friend
Messages: 6
Registered: March 2011
Junior Member
Razz Razz Razz Razz Razz Razz Razz Razz Razz Razz Razz Razz


I have code completion NOW.....


thank U for all your help
Re: How to get code completion (MacOS eclipse CDT) [message #662829 is a reply to message #661592] Fri, 01 April 2011 06:45 Go to previous messageGo to next message
Axel Mueller is currently offline Axel MuellerFriend
Messages: 1973
Registered: July 2009
Senior Member
Michael Jackson wrote on Fri, 25 March 2011 15:06
On 3/25/11 3:10 AM, in article imheod$h31$1@news.eclipse.org
CDT: Patch the scanner discovery parser code to understand -F and OS X
Frameworks and make all of the above "just work". Since OS X compatibility
has usually been fairly low on the priority list for CDT devs I always opt
for fix #1.


There is some ongoing work for CDT 8.0
http://wiki.eclipse.org/CDT/ScannerDiscovery61/Stories
I think this is a good chance to get your request fixed. You should open a new bugzilla request.


Before you ask
- search this forum
- see the FAQ http://wiki.eclipse.org/CDT/User/FAQ
- google
Re: How to get code completion (MacOS eclipse CDT) [message #663033 is a reply to message #662829] Sat, 02 April 2011 14:25 Go to previous messageGo to next message
Andrew Gvozdev is currently offline Andrew GvozdevFriend
Messages: 257
Registered: July 2009
Senior Member
There is already open bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=69529. It is pretty clear what needs to be done in code (to me anyway) but it'll take a contributor working on Mac willing to make a patch.

Andrew
Re: How to get code completion (MacOS eclipse CDT) [message #755759 is a reply to message #663033] Wed, 09 November 2011 14:03 Go to previous message
Rizki Sunaryo is currently offline Rizki SunaryoFriend
Messages: 2
Registered: November 2011
Junior Member
Mr. MauPaz
I use Scientific Linux 6, and I have the same problem...
And I can't fix it...

Can you tell me what you have done, Sir?

Your help will be so meaningful for me... ^_^
Previous Topic:simple question about project name
Next Topic:Enable C99 standard
Goto Forum:
  


Current Time: Fri Apr 26 04:00:30 GMT 2024

Powered by FUDForum. Page generated in 0.04030 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top