Skip to main content



      Home
Home » Language IDEs » C / C++ IDE (CDT) » Code assist does not work in header files?
Code assist does not work in header files? [message #147548] Sun, 26 June 2005 14:39 Go to next message
Eclipse UserFriend
Originally posted by: bandrews.nospam_bphnx.com

Hi All,

I cannot get code assist to work at all in header files. When I hit
CTRL+SPACE, I just get garbage. If I move the code to a cpp file, it
works fine. Can someone else confirm this? I could not find a bug on it.


thanks,

Barry
Re: Code assist does not work in header files? [message #147558 is a reply to message #147548] Mon, 27 June 2005 03:05 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: plankton.softwitch.net

Barry Andrews wrote:
> Hi All,
>
> I cannot get code assist to work at all in header files. When I hit
> CTRL+SPACE, I just get garbage. If I move the code to a cpp file, it
> works fine. Can someone else confirm this? I could not find a bug on it.
>
>
> thanks,
>
> Barry

Code Assist looks based on binary indexer. so, source must be compiled
before using code assistance.

anyway, if you using managed project, just put the include statement
into the source contains main function. then build, then index of header
file will be build, and code assistance will work.
Re: Code assist does not work in header files? [message #147582 is a reply to message #147558] Mon, 27 June 2005 10:06 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: bandrews.nospam_bphnx.com

Really? Code must be compiled first? That's rather odd isn't it?

Anyway... so will this work if I don't use a managed project? I really
don't like the idea of including headers in the main source file.

This is quite important for anyone using a QT Designer project, because
the way QT Designer works, you typically put your GUI code in the header
file. This code gets included in a moc cpp file when you build it. So
the cpp file gets regenerated every time.

I will try what you said and see if it helps.


thanks a lot!

Barry



jiyul wrote:
> Barry Andrews wrote:
>
>> Hi All,
>>
>> I cannot get code assist to work at all in header files. When I
>> hit CTRL+SPACE, I just get garbage. If I move the code to a cpp file,
>> it works fine. Can someone else confirm this? I could not find a bug
>> on it.
>>
>>
>> thanks,
>>
>> Barry
>
>
> Code Assist looks based on binary indexer. so, source must be compiled
> before using code assistance.
>
> anyway, if you using managed project, just put the include statement
> into the source contains main function. then build, then index of header
> file will be build, and code assistance will work.
Re: Code assist does not work in header files? [message #147590 is a reply to message #147582] Mon, 27 June 2005 10:27 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: dschaefer.rogers.com

Barry Andrews wrote:
> Really? Code must be compiled first? That's rather odd isn't it?

Yes, it would be odd, and that probably why we didn't do it that way :)

First of all, which version are you using? We've done a lot of work in
3.0 for content assist. It should be working a lot better in header files.

The main issue we've had in the past is that the content assist was
driven by the parser which needs proper build information like inclusion
paths and macro defs to parse correctly. Header files are even more
tricky since you don't build them on their own.

In 3.0 and beyond, we have and will be adding more heuristics to get by
the incomplete information.

Hope this helps,
Doug.

>
> Anyway... so will this work if I don't use a managed project? I really
> don't like the idea of including headers in the main source file.
>
> This is quite important for anyone using a QT Designer project, because
> the way QT Designer works, you typically put your GUI code in the header
> file. This code gets included in a moc cpp file when you build it. So
> the cpp file gets regenerated every time.
>
> I will try what you said and see if it helps.
>
>
> thanks a lot!
>
> Barry
>
>
>
> jiyul wrote:
>
>> Barry Andrews wrote:
>>
>>> Hi All,
>>>
>>> I cannot get code assist to work at all in header files. When I
>>> hit CTRL+SPACE, I just get garbage. If I move the code to a cpp file,
>>> it works fine. Can someone else confirm this? I could not find a bug
>>> on it.
>>>
>>>
>>> thanks,
>>>
>>> Barry
>>
>>
>>
>> Code Assist looks based on binary indexer. so, source must be compiled
>> before using code assistance.
>>
>> anyway, if you using managed project, just put the include statement
>> into the source contains main function. then build, then index of
>> header file will be build, and code assistance will work.


--
Doug Schaefer, Senior Software Developer
IBM Rational Software, Ottawa Lab
Kanata, Ontario, Canada
Re: Code assist does not work in header files? [message #147607 is a reply to message #147590] Mon, 27 June 2005 10:45 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: bandrews.nospam_bphnx.com

I didn't think compiling had anything to do with it. I see that the
indexer runs when I save a file or open a project, NOT when I compile.

I am using 3.0M7 which I believe is the latest.

Last night, I couldn't get anything in a header file to use code assist,
but maybe there is something very specific about it. I will experiment
some more and see if I can put together a small reproducable test case.


thanks,

Barry




Doug Schaefer wrote:
> Barry Andrews wrote:
>
>> Really? Code must be compiled first? That's rather odd isn't it?
>
>
> Yes, it would be odd, and that probably why we didn't do it that way :)
>
> First of all, which version are you using? We've done a lot of work in
> 3.0 for content assist. It should be working a lot better in header files.
>
> The main issue we've had in the past is that the content assist was
> driven by the parser which needs proper build information like inclusion
> paths and macro defs to parse correctly. Header files are even more
> tricky since you don't build them on their own.
>
> In 3.0 and beyond, we have and will be adding more heuristics to get by
> the incomplete information.
>
> Hope this helps,
> Doug.
>
>>
>> Anyway... so will this work if I don't use a managed project? I really
>> don't like the idea of including headers in the main source file.
>>
>> This is quite important for anyone using a QT Designer project,
>> because the way QT Designer works, you typically put your GUI code in
>> the header file. This code gets included in a moc cpp file when you
>> build it. So the cpp file gets regenerated every time.
>>
>> I will try what you said and see if it helps.
>>
>>
>> thanks a lot!
>>
>> Barry
>>
>>
>>
>> jiyul wrote:
>>
>>> Barry Andrews wrote:
>>>
>>>> Hi All,
>>>>
>>>> I cannot get code assist to work at all in header files. When I
>>>> hit CTRL+SPACE, I just get garbage. If I move the code to a cpp
>>>> file, it works fine. Can someone else confirm this? I could not find
>>>> a bug on it.
>>>>
>>>>
>>>> thanks,
>>>>
>>>> Barry
>>>
>>>
>>>
>>>
>>> Code Assist looks based on binary indexer. so, source must be
>>> compiled before using code assistance.
>>>
>>> anyway, if you using managed project, just put the include statement
>>> into the source contains main function. then build, then index of
>>> header file will be build, and code assistance will work.
>
>
>
Re: Code assist does not work in header files? [message #147623 is a reply to message #147607] Mon, 27 June 2005 20:13 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: plankton.softwitch.net

Sorry for answer without think seriously. I thought it still doesn't
work by heard yours. So I guessed code-assistance based on build, and I
tested it on wrong idea. anyway mine worked well(even if i did nothing,
it should work), so I sured wrong infomation. Sorry :(

I tried it again with 3.0m7, and I saw indexer working on save.
and code assistance works well on header.

what'r problems for now...?


Barry Andrews wrote:
> I didn't think compiling had anything to do with it. I see that the
> indexer runs when I save a file or open a project, NOT when I compile.
>
> I am using 3.0M7 which I believe is the latest.
>
> Last night, I couldn't get anything in a header file to use code assist,
> but maybe there is something very specific about it. I will experiment
> some more and see if I can put together a small reproducable test case.
>
>
> thanks,
>
> Barry
>
>
>
>
> Doug Schaefer wrote:
>
>> Barry Andrews wrote:
>>
>>> Really? Code must be compiled first? That's rather odd isn't it?
>>
>>
>>
>> Yes, it would be odd, and that probably why we didn't do it that way :)
>>
>> First of all, which version are you using? We've done a lot of work in
>> 3.0 for content assist. It should be working a lot better in header
>> files.
>>
>> The main issue we've had in the past is that the content assist was
>> driven by the parser which needs proper build information like
>> inclusion paths and macro defs to parse correctly. Header files are
>> even more tricky since you don't build them on their own.
>>
>> In 3.0 and beyond, we have and will be adding more heuristics to get
>> by the incomplete information.
>>
>> Hope this helps,
>> Doug.
>>
>>>
>>> Anyway... so will this work if I don't use a managed project? I
>>> really don't like the idea of including headers in the main source file.
>>>
>>> This is quite important for anyone using a QT Designer project,
>>> because the way QT Designer works, you typically put your GUI code in
>>> the header file. This code gets included in a moc cpp file when you
>>> build it. So the cpp file gets regenerated every time.
>>>
>>> I will try what you said and see if it helps.
>>>
>>>
>>> thanks a lot!
>>>
>>> Barry
>>>
>>>
>>>
>>> jiyul wrote:
>>>
>>>> Barry Andrews wrote:
>>>>
>>>>> Hi All,
>>>>>
>>>>> I cannot get code assist to work at all in header files. When I
>>>>> hit CTRL+SPACE, I just get garbage. If I move the code to a cpp
>>>>> file, it works fine. Can someone else confirm this? I could not
>>>>> find a bug on it.
>>>>>
>>>>>
>>>>> thanks,
>>>>>
>>>>> Barry
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> Code Assist looks based on binary indexer. so, source must be
>>>> compiled before using code assistance.
>>>>
>>>> anyway, if you using managed project, just put the include statement
>>>> into the source contains main function. then build, then index of
>>>> header file will be build, and code assistance will work.
>>
>>
>>
>>
Re: Code assist does not work in header files? [message #147630 is a reply to message #147623] Mon, 27 June 2005 21:44 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: bandrews.nospam_bphnx.com

Ok, I figured out the problem! I just don't know what to do about it. ;)
Basically, yes code assist does work for header files! Hats off to the
developers!!! Very nice!

But I have a very specific problem, and I believe anyone who has a Qt
Designer project will have the same. Maybe this will apply to other
projects as well, but it would probably be rare.

When you have a Qt Designer project, you get a .ui directory created for
you. That directory contains the generated source that Qt generates from
the GUI XML files. ( And the XML files are created from the visual GUI
editing tool. ) So you have a header and a cpp file for each window in
this directory. Those files are not touched by the developer. But
instead you have another header file outside the .ui directory that you
should modify. At compile time, your source is incorporated into the
source files in the .ui directory. Well, I don't know ALL the details,
but this is the basics and hopefully you get the idea.

So when I created the Standard Makefile C++ project from an already
existing project, the .ui directory was not included in the project
Includes. Well... you can see the directory itself, but it shows there
are no files in the directory. But files do exist!

So it seems the problem is CDT is ignoring files that are in a directory
that begins with dot. I created a Simple project with a .ui directory,
added a file and unchecked .* from filters and the files show.
However source files do not show in the C++ Project Includes.

I will gladly log a bug unless someone can tell me how to get the CDT to
recognize files in directories that begin with '.'

BTW, this does work in Visual Slick Edit v10 on Linux. It will tag the
files in the .ui directory and code assist will work in my header file.


thanks,

Barry


jiyul wrote:
> Sorry for answer without think seriously. I thought it still doesn't
> work by heard yours. So I guessed code-assistance based on build, and I
> tested it on wrong idea. anyway mine worked well(even if i did nothing,
> it should work), so I sured wrong infomation. Sorry :(
>
> I tried it again with 3.0m7, and I saw indexer working on save.
> and code assistance works well on header.
>
> what'r problems for now...?
>
>
> Barry Andrews wrote:
>
>> I didn't think compiling had anything to do with it. I see that the
>> indexer runs when I save a file or open a project, NOT when I compile.
>>
>> I am using 3.0M7 which I believe is the latest.
>>
>> Last night, I couldn't get anything in a header file to use code
>> assist, but maybe there is something very specific about it. I will
>> experiment some more and see if I can put together a small
>> reproducable test case.
>>
>>
>> thanks,
>>
>> Barry
>>
>>
>>
>>
>> Doug Schaefer wrote:
>>
>>> Barry Andrews wrote:
>>>
>>>> Really? Code must be compiled first? That's rather odd isn't it?
>>>
>>>
>>>
>>>
>>> Yes, it would be odd, and that probably why we didn't do it that way :)
>>>
>>> First of all, which version are you using? We've done a lot of work
>>> in 3.0 for content assist. It should be working a lot better in
>>> header files.
>>>
>>> The main issue we've had in the past is that the content assist was
>>> driven by the parser which needs proper build information like
>>> inclusion paths and macro defs to parse correctly. Header files are
>>> even more tricky since you don't build them on their own.
>>>
>>> In 3.0 and beyond, we have and will be adding more heuristics to get
>>> by the incomplete information.
>>>
>>> Hope this helps,
>>> Doug.
>>>
>>>>
>>>> Anyway... so will this work if I don't use a managed project? I
>>>> really don't like the idea of including headers in the main source
>>>> file.
>>>>
>>>> This is quite important for anyone using a QT Designer project,
>>>> because the way QT Designer works, you typically put your GUI code
>>>> in the header file. This code gets included in a moc cpp file when
>>>> you build it. So the cpp file gets regenerated every time.
>>>>
>>>> I will try what you said and see if it helps.
>>>>
>>>>
>>>> thanks a lot!
>>>>
>>>> Barry
>>>>
>>>>
>>>>
>>>> jiyul wrote:
>>>>
>>>>> Barry Andrews wrote:
>>>>>
>>>>>> Hi All,
>>>>>>
>>>>>> I cannot get code assist to work at all in header files. When
>>>>>> I hit CTRL+SPACE, I just get garbage. If I move the code to a cpp
>>>>>> file, it works fine. Can someone else confirm this? I could not
>>>>>> find a bug on it.
>>>>>>
>>>>>>
>>>>>> thanks,
>>>>>>
>>>>>> Barry
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> Code Assist looks based on binary indexer. so, source must be
>>>>> compiled before using code assistance.
>>>>>
>>>>> anyway, if you using managed project, just put the include
>>>>> statement into the source contains main function. then build, then
>>>>> index of header file will be build, and code assistance will work.
>>>
>>>
>>>
>>>
>>>
Re: Code assist does not work in header files? [message #147796 is a reply to message #147630] Wed, 29 June 2005 20:29 Go to previous message
Eclipse UserFriend
Originally posted by: bandrews.nospam_bphnx.com

Well... in case anyone is following this thread, I have finally figured
out the problem. I just needed to use
#include ".ui/myheader.h" in my user modifiable header file. I didn't
have to do this in SlickEdit. As long as a file is tagged in SlickEdit,
code assist will find the symbols. So CDT's way is not bad and I am sure
it will get better over time. :) It's a little strange to include a
header within a header when the header is really the same. Huh? But this
is Qt, and it is a little different anyway. Anyway.... it works and I am
happy!


thanks for the replies!

Barry



Barry Andrews wrote:
> Ok, I figured out the problem! I just don't know what to do about it. ;)
> Basically, yes code assist does work for header files! Hats off to the
> developers!!! Very nice!
>
> But I have a very specific problem, and I believe anyone who has a Qt
> Designer project will have the same. Maybe this will apply to other
> projects as well, but it would probably be rare.
>
> When you have a Qt Designer project, you get a .ui directory created for
> you. That directory contains the generated source that Qt generates from
> the GUI XML files. ( And the XML files are created from the visual GUI
> editing tool. ) So you have a header and a cpp file for each window in
> this directory. Those files are not touched by the developer. But
> instead you have another header file outside the .ui directory that you
> should modify. At compile time, your source is incorporated into the
> source files in the .ui directory. Well, I don't know ALL the details,
> but this is the basics and hopefully you get the idea.
>
> So when I created the Standard Makefile C++ project from an already
> existing project, the .ui directory was not included in the project
> Includes. Well... you can see the directory itself, but it shows there
> are no files in the directory. But files do exist!
>
> So it seems the problem is CDT is ignoring files that are in a directory
> that begins with dot. I created a Simple project with a .ui directory,
> added a file and unchecked .* from filters and the files show.
> However source files do not show in the C++ Project Includes.
>
> I will gladly log a bug unless someone can tell me how to get the CDT to
> recognize files in directories that begin with '.'
>
> BTW, this does work in Visual Slick Edit v10 on Linux. It will tag the
> files in the .ui directory and code assist will work in my header file.
>
>
> thanks,
>
> Barry
>
>
> jiyul wrote:
>
>> Sorry for answer without think seriously. I thought it still doesn't
>> work by heard yours. So I guessed code-assistance based on build, and
>> I tested it on wrong idea. anyway mine worked well(even if i did
>> nothing, it should work), so I sured wrong infomation. Sorry :(
>>
>> I tried it again with 3.0m7, and I saw indexer working on save.
>> and code assistance works well on header.
>>
>> what'r problems for now...?
>>
>>
>> Barry Andrews wrote:
>>
>>> I didn't think compiling had anything to do with it. I see that the
>>> indexer runs when I save a file or open a project, NOT when I compile.
>>>
>>> I am using 3.0M7 which I believe is the latest.
>>>
>>> Last night, I couldn't get anything in a header file to use code
>>> assist, but maybe there is something very specific about it. I will
>>> experiment some more and see if I can put together a small
>>> reproducable test case.
>>>
>>>
>>> thanks,
>>>
>>> Barry
>>>
>>>
>>>
>>>
>>> Doug Schaefer wrote:
>>>
>>>> Barry Andrews wrote:
>>>>
>>>>> Really? Code must be compiled first? That's rather odd isn't it?
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> Yes, it would be odd, and that probably why we didn't do it that way :)
>>>>
>>>> First of all, which version are you using? We've done a lot of work
>>>> in 3.0 for content assist. It should be working a lot better in
>>>> header files.
>>>>
>>>> The main issue we've had in the past is that the content assist was
>>>> driven by the parser which needs proper build information like
>>>> inclusion paths and macro defs to parse correctly. Header files are
>>>> even more tricky since you don't build them on their own.
>>>>
>>>> In 3.0 and beyond, we have and will be adding more heuristics to get
>>>> by the incomplete information.
>>>>
>>>> Hope this helps,
>>>> Doug.
>>>>
>>>>>
>>>>> Anyway... so will this work if I don't use a managed project? I
>>>>> really don't like the idea of including headers in the main source
>>>>> file.
>>>>>
>>>>> This is quite important for anyone using a QT Designer project,
>>>>> because the way QT Designer works, you typically put your GUI code
>>>>> in the header file. This code gets included in a moc cpp file when
>>>>> you build it. So the cpp file gets regenerated every time.
>>>>>
>>>>> I will try what you said and see if it helps.
>>>>>
>>>>>
>>>>> thanks a lot!
>>>>>
>>>>> Barry
>>>>>
>>>>>
>>>>>
>>>>> jiyul wrote:
>>>>>
>>>>>> Barry Andrews wrote:
>>>>>>
>>>>>>> Hi All,
>>>>>>>
>>>>>>> I cannot get code assist to work at all in header files. When
>>>>>>> I hit CTRL+SPACE, I just get garbage. If I move the code to a cpp
>>>>>>> file, it works fine. Can someone else confirm this? I could not
>>>>>>> find a bug on it.
>>>>>>>
>>>>>>>
>>>>>>> thanks,
>>>>>>>
>>>>>>> Barry
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> Code Assist looks based on binary indexer. so, source must be
>>>>>> compiled before using code assistance.
>>>>>>
>>>>>> anyway, if you using managed project, just put the include
>>>>>> statement into the source contains main function. then build, then
>>>>>> index of header file will be build, and code assistance will work.
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
Previous Topic:AIX support
Next Topic:Launch failed no binaries error
Goto Forum:
  


Current Time: Sat Jun 07 08:53:29 EDT 2025

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

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

Back to the top