Project Home
Project Home
Trackers
Trackers
Documents
Documents
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - IDE can't find my include directories anymore from time to time!: (11 Items)
   
IDE can't find my include directories anymore from time to time!  
Hi

I'm about to lose my sanity... For months, I've been battling with the IDE to include my files properly. No matter what 
I do or how much I search in the User's Guide or the forums, I can't seem to make it work.

In my desperation, I've tried using a makefile project (QNX C++ project), then converted it to a managed project..  now 
I've been trying with a C++ project (which is like managed project, I guess).

My directory structure is like this:

/Core
--/src/Blocks
--/src/Elements
--/src/VMC

/Library
--/XMLParser
--/DebugTools

The project is in the directory /Core
The workspace is in the directory / 
The /Library folder contains the sources I want to include.
Since I created the project in /Core, only this folder and its subdirectories are shown in Project Explorer. I actually 
have to include the subdirectories manually.. btw.

What I do is for example: in  /Core/src/Blocks/block.cpp  i write #include "xmlParser.h" (which is located in /Library/
XMLParser/)

I've tried adding my include directories using relative paths (with the variables ${workspace_loc} or ${project_loc} ) 
or even as absolute paths.

What happens is that it works.. and then sometimes it just stops working and all I can do is create a new project and 
add all the directories again. Sometimes when recompiling, it just stops working. Sometimes it's fixed by doing a "
rebuild all", sometimes not.

I've tried adding the source files as source folders... to no avail.
Sometimes the includes are displayed as /EXT_SRV_PATH/.. entries in the Project Explorer.

I've tried this with IDE 4.5, IDE 4.6.1 and IDE 4.7 --- same problem.

1) What am I doing wrong? I'm more used to a Visual Studio environment, maybe I didn't get some "Eclipse" concept...

2) Why are the subdirectories in my own project folder not included automatically? 

I'm using:   Momentics IDE   Version: 4.6.1 ,  Build id: I20091014

Thanks in advance for any help.

~Lorenz



Re: IDE can't find my include directories anymore from time to time!  
Hi, Lorenz,

Se some replies in-line, below.

HTH,

Christian


On Thu, 2010-02-04 at 08:48 -0500, Lorenz Bucher wrote:

> Hi
> 
> I'm about to lose my sanity... For months, I've been battling with the IDE to include my files properly. No matter 
what I do or how much I search in the User's Guide or the forums, I can't seem to make it work.
> 
> In my desperation, I've tried using a makefile project (QNX C++ project), then converted it to a managed project..  
now I've been trying with a C++ project (which is like managed project, I guess).


A QNX Project works very differently from managed C/C++ projects.  The
recursive makefile infrastructure does add all of the ancestor folders
of a particular variant folder to the include path for that particular
variant.  However, if you need other folders to be in the include path,
then you need to add them in the common.mk using the EXTRA_INCVPATH
variable.

Converting a QNX Project to a managed project (no makefile generation)
should continue to work, it just means that you will have to manage the
common.mk file yourself rather than using the Project Properties UI.
Automatic makefile generation isn't really viable for the recursive
makefile structure.


> My directory structure is like this:
> 
> /Core
> --/src/Blocks
> --/src/Elements
> --/src/VMC
> 
> /Library
> --/XMLParser
> --/DebugTools


Your workspace isn't actually the filesystem root, is it?  I doubt that
it would cause problems for the IDE, but you never know ...


> The project is in the directory /Core
> The workspace is in the directory / 
> The /Library folder contains the sources I want to include.
> Since I created the project in /Core, only this folder and its subdirectories are shown in Project Explorer. I 
actually have to include the subdirectories manually.. btw.


This is expected.  The IDE doesn't automatically add all folders in a
project to the include path.

Why don't you also crate a Library project?  That might make it easier
to maintain the header and linker dependencies in the IDE.



> What I do is for example: in  /Core/src/Blocks/block.cpp  i write #include "xmlParser.h" (which is located in /Library
/XMLParser/)
> 
> I've tried adding my include directories using relative paths (with the variables ${workspace_loc} or ${project_loc} )
 or even as absolute paths.
> 
> What happens is that it works.. and then sometimes it just stops working and all I can do is create a new project and 
add all the directories again. Sometimes when recompiling, it just stops working. Sometimes it's fixed by doing a "
rebuild all", sometimes not.


I can't say that I've seen this "just stop working" before.  It's
difficult to guess why.



> I've tried adding the source files as source folders... to no avail.


You wouldn't want to do that, because then the source will be compiled
into your Core project's binary, which probably isn't what you want.



> Sometimes the includes are displayed as /EXT_SRV_PATH/.. entries in the Project Explorer.


Are you using a QNX Project?  That is how it shows the
dynamically-constructed "extra sources" path.



> I've tried this with IDE 4.5, IDE 4.6.1 and IDE 4.7 --- same problem.
> 
> 1) What am I doing wrong? I'm more used to a Visual Studio environment, maybe I didn't get some "Eclipse" concept...


Eclipse CDT and, by extension, the Momentics IDE is quite different from
VisualStudio in many respects.  Include path management is just one of
them, as you have observed.



> 2) Why are the subdirectories in my own project folder not included automatically? 


Because that's just not an assumption that the CDT build system makes.
Although, I notice that the indexer sees things differently:  in a
non-QNX project, the editor resolves includes that the compiler doesn't,
because they aren't in the...
View Full Message
Re: IDE can't find my include directories anymore from time to time!  
Thanks a lot for your fast reply, Christian.

Your post did indeed already clarify a lot for me.
I also re-read some stuff in the IDE user's guide and finally realized that if I create a QNX C++ project and convert it
 to a managed project, it's the same as just creating a C++ project right away. So the difference between the QNX* types
 and the "normal" types is only the makefile/managed project nature. Right?

I am trying to work with a managed project, i.e. without recursive makefiles. If I understood you correctly, that means 
I'm on the right track by creating a "C++ Project". I only need x86 as target architecture.


> Your workspace isn't actually the filesystem root, is it?  I doubt that
> it would cause problems for the IDE, but you never know ...

No, of course not..  :-)  I even have a path without any spaces in it, as this is known to cause problems sometimes.

> Why don't you also crate a Library project?  That might make it easier
> to maintain the header and linker dependencies in the IDE.

I've tried that before, but it doesn't work.. You mean creating a project in the /Library folder and then adding that to
 the workspace, I presume. The problem was that it keeps looking for a main() function in the library project.
So I created a dummy main function (i.e. int main(){return 0;} ).
It still can't find the include files.


>I've tried adding the source files as source folders... to no avail.
>>You wouldn't want to do that, because then the source will be compiled
>>into your Core project's binary, which probably isn't what you want.

No, that's exactly what I want. My library folders contain not only header files, but also .cpp files.

The reason I have certain source files in the library folder is that I share them between several projects.
For example, I can have the /Core and the /Core2 project both using source files from the the /Library folder/project.

I've also tried adding a folder to the Core project and then selecting "link to filesystem folder", but there I was 
unable to use relative paths.
If I do this with absolute paths, it says "${workspace_loc:/Core/Library/XMLParser"
under project properties, but if look under "includes" in the project explorer, I see "C:/QNX640/Debug/${workspace_loc::
/Core/Library/XMLParser", so something is being messed up with the variables, IMO.

I must add that my project/source files are all on my D:\ drive, while the IDE is on the C:\ drive... just in case 
that's a known bug or something.


Are my methods unsual? I could of course just copy the Library folder into the project folder and synchronize it with 
other projects

Kind regards,
~Lorenz
Re: IDE can't find my include directories anymore from time to time!  
Another thing that seems to be a problem:
I have includes between the folders in my library folders.
i.e. /Library/XMLParser/xmlparser.cpp  includes /Library/DebugTools/debug.h

I can solve that by writing the include with the relative folder path: #include "../DebugTools/debug.h

I mean, I could solve everything by doing all my #includes with relative paths... but it should be possible to set the 
include directories properly (as relative paths) and then do the includes normally, right?




Re: IDE can't find my include directories anymore from time to time!  
Hi, Lorenz,

Yes, it is common in libraries that provide several header files that
they may be grouped into directories, some of which are meant to be
referenced by user code, and some only internally by the library code.
Usually when building client code one adds only the root directory of
the include tree to the include path.

For example, in the C library of most *NIX systems, we usually
add /usr/include to the path, which makes

   #include <stdio.h>
   #include <sys/types.h>

both work because the types.h header is in the /usr/include/sys
directory.

You would not usually want to have a project name like "DebugTools" in
your source code, no.  This is a case for the IDE's include path
management.

Cheers,

Christian


On Fri, 2010-02-05 at 03:22 -0500, Lorenz Bucher wrote:

> Another thing that seems to be a problem:
> I have includes between the folders in my library folders.
> i.e. /Library/XMLParser/xmlparser.cpp  includes /Library/DebugTools/debug.h
> 
> I can solve that by writing the include with the relative folder path: #include "../DebugTools/debug.h
> 
> I mean, I could solve everything by doing all my #includes with relative paths... but it should be possible to set the
 include directories properly (as relative paths) and then do the includes normally, right?
> 
> 
> 
> 
> 
> 
> 
> 
> _______________________________________________
> 
> General
> http://community.qnx.com/sf/go/post46624


Re: IDE can't find my include directories anymore from time to time!  
Hi, Lorenz,

See some more replies in-line, below.

HTH,

Christian

On Thu, 2010-02-04 at 12:00 -0500, Lorenz Bucher wrote:

> Thanks a lot for your fast reply, Christian.
> 
> Your post did indeed already clarify a lot for me.
> I also re-read some stuff in the IDE user's guide and finally realized that if I create a QNX C++ project and convert 
it to a managed project, it's the same as just creating a C++ project right away. So the difference between the QNX* 
types and the "normal" types is only the makefile/managed project nature. Right?


Well, the QNX Project also relies on a clever library of makefiles in
the SDP target that would have to be supplied to a stock CDT make
project.  There are only a few environment variables required for that.
In any case, it doesn't sound like your problem is related to this.



> I am trying to work with a managed project, i.e. without recursive makefiles. If I understood you correctly, that 
means I'm on the right track by creating a "C++ Project". I only need x86 as target architecture.


Sure, that's the way to go if you're not using the recursive makefiles.



> > Your workspace isn't actually the filesystem root, is it?  I doubt that
> > it would cause problems for the IDE, but you never know ...
> 
> No, of course not..  :-)  I even have a path without any spaces in it, as this is known to cause problems sometimes.


heh heh ... I didn't really think so.  :-)



> > Why don't you also crate a Library project?  That might make it easier
> > to maintain the header and linker dependencies in the IDE.
> 
> I've tried that before, but it doesn't work.. You mean creating a project in the /Library folder and then adding that 
to the workspace, I presume. The problem was that it keeps looking for a main() function in the library project.
> So I created a dummy main function (i.e. int main(){return 0;} ).
> It still can't find the include files.


I thought that the /Library folder was intended actually to create a
library object (.a or .so).  I didn't understand that it was just
sources shared by a number of projects.



> >I've tried adding the source files as source folders... to no avail.
> >>You wouldn't want to do that, because then the source will be compiled
> >>into your Core project's binary, which probably isn't what you want.
> 
> No, that's exactly what I want. My library folders contain not only header files, but also .cpp files.
> 
> The reason I have certain source files in the library folder is that I share them between several projects.
> For example, I can have the /Core and the /Core2 project both using source files from the the /Library folder/project.



Yes, well, this is the purpose of the "source path," to include sources
from some other location in your build.



> I've also tried adding a folder to the Core project and then selecting "link to filesystem folder", but there I was 
unable to use relative paths.


The problem with this is that the filesystem and the make tool don't
know anything about the Eclipse workspace's "linked folders."  They are
just a fiction in the IDE.  Makefiles still require real filesystem
paths.



> If I do this with absolute paths, it says "${workspace_loc:/Core/Library/XMLParser"
> under project properties, but if look under "includes" in the project explorer, I see "C:/QNX640/Debug/${workspace_loc
::/Core/Library/XMLParser", so something is being messed up with the variables, IMO.


I thought that /Core and /Library were sibling folders, not nested?
Perhaps it is simply a typo in your post, but the closing "}" is missing
from your workspace_loc variable expression.  That would case the
makefile generator to be unable to translate it to a real filesystem
path in the makefile, nor to add the correct filesystem path into the
C/C++ Index's include...
View Full Message
Re: IDE can't find my include directories anymore from time to time!  
Thank you very much for your replies.

I'm sorry that my posts are quite chaotic. I quite lost in haze of project types, paths and IDE. But thanks to your 
replies it's slowly getting clearer in my head.

I made a .zip file with a brand new Test Project (I chose a "Hello World" C++ project) and extended it with some include
 files..

I added the includes as relative paths: ${project_loc}/../TestLibrary/TableCollectionXML

The project is in what I'd like to call a "Meta-stable state".
I compiled fine on my computer, but displays the Warning "include path not found"
From my experience, this will work for a while... then suddenly, it will not be able to find the includes anymore.

I hope you understand what I mean. Else, just let me know.

Thanks for taking a look at it.

~Lorenz
Attachment: Text MomenticsTest.zip 80.02 KB
Re: IDE can't find my include directories anymore from time to time!  
Hi, Lorenz,

Thanks for the sample project.  That makes it so much easier to
investigate the problem!

Your problem (in the sample, at least) is that CDT does not recognize
the ${project_loc} variable.  I'm not sure why it sometimes works in the
build.

If I update the include directories in the project settings to use the
${ProjDirPath} variable (defined by CDT, not be Eclipse Platform), then
everything works:  I can build the project and Ctrl+Click navigation on
the header files and symbols defined in the TestLibrary folder works as
expected.

I think that earlier you tried to use the ${workspace_loc} variable.  In
the CDT context (unlike, say, Eclipse Platform's launch configurations)
this can only reference resources that are actually in the workspace.
Any path extension after the variable is, apparently, truncated.  So,
for example,

   ${workspace_loc}/TestProject

and

   ${workspace_loc}/TestLibrary/XMLParser

both resolve to the workspace root folder despite the fact that in the
former case there actually is a workspace resource named "TestProject"
in the workspace directory.

Doing this:

  ${workspace_loc:/TestProject}

resolves to the TestProject folder location, but then again, so does:

  ${workspace_loc:/TestProject}/../TestLibrary/XMLParser

The following *does* work as expected, because it uses a CDT-defined
variable:

  ${WorkspaceDirPath}/TestLibrary/XMLParser

However, in general, I would personally prefer

  ${ProjDirPath}/../TestLibrary/XMLParser

because at least this only assumes that the TestProject and TestLibrary
folders are collocated in the same parent, but not additionally that
that parent folder is the workspace directory.

Cheers,

Christian


On Fri, 2010-02-05 at 12:20 -0500, Lorenz Bucher wrote:

> Thank you very much for your replies.
> 
> I'm sorry that my posts are quite chaotic. I quite lost in haze of project types, paths and IDE. But thanks to your 
replies it's slowly getting clearer in my head.
> 
> I made a .zip file with a brand new Test Project (I chose a "Hello World" C++ project) and extended it with some 
include files..
> 
> I added the includes as relative paths: ${project_loc}/../TestLibrary/TableCollectionXML
> 
> The project is in what I'd like to call a "Meta-stable state".
> I compiled fine on my computer, but displays the Warning "include path not found"
> From my experience, this will work for a while... then suddenly, it will not be able to find the includes anymore.
> 
> I hope you understand what I mean. Else, just let me know.
> 
> Thanks for taking a look at it.
> 
> ~Lorenz
> 
> 
> 
> 
> _______________________________________________
> 
> General
> http://community.qnx.com/sf/go/post46698


________________________________________________________________________

Christian W. Damus
Software Developer, IDE Team
QNX Software Systems
Re: IDE can't find my include directories anymore from time to time!  
Hello Christian

Thank you so much for those explanations. I had suspected there might be some variables that were CDT-internal and some 
more Momentics IDE-specific, but I didn't know which were which. It seems it boils down to the path variables or more 
like how they're resolved by the IDE.

I've settled for this variant:
${ProjDirPath}/../TestLibrary/XMLParser

which I also prefer, since a colleague can import my project into any workspace and all he has to make sure is that /
Library and /Core are sibling directories.

Now, there ARE some weird things going on, in my opinion...
At first, it would work in the debug but not in the release version, even though I made exactly the same entries for 
both variants in the project options.
So I removed all the includes, in both variants separately and even in the [All Configurations] variant. I closed the 
project properties dialog, and then opened it again and added the 2 library includes to the release version and compiled
 it. It works now.
So I switch to the debug version and also add the includes and... it doesn't compile. Yes, I've tried Clean/Rebuild All.

I get lots of "undefined reference to ..." errors.

I wonder if you can reproduce this behaviour on your computer. It would surely help you understand why I claim I'm 
losing my mind ;-)

The funny thing is: in all cases, if browse the includes in the Project Explorer, the paths are correct. So it IS 
resolving the path variables properly, right?

Also, I've noticed it DOES matter whether I enter my paths in the "C++ General>Paths and Symbols>Includes" or in the "C+
+ Build>Settings>QCC Compiler>PreProcessor" tabs, even though their content is linked...
For example, I enter "../Library" in the Paths and Symbols field, it will show up as 
"../../Library" in the QCC Compiler settings.

I even tried deleting the project files and creating a project file from scratch. 

I'm beginning to think I really have a buggy build of the IDE or something. Or would you say this behaviour is normal? 
I'm currently downloading build 20090510 and will try that.

--
Another thing I've noticed, which might be an IDE bug:

In the project properties dialog, if I go to >C++ General>Paths and Symbols and I select [All Configurations], some 
things behave strangely (compared to when I select just "Debug" or "Release"):

* In languages: where it used to say "GNU C", it now says "c,C,cc,cpp,i,ii"
* When I try to add a directory and click on Add>Variables, the window with the variables doesn't show up at all. 

Also, "Add to all configurations" does not work... (or at least not always) when I add something, it just dissappears.
--

~Lorenz
Re: IDE can't find my include directories anymore from time to time!  
Hi, Lorenz,

See some more replies in-line, below.

HTH,

Christian


On Sat, 2010-02-06 at 08:30 -0500, Lorenz Bucher wrote:

> Hello Christian
> 
> Thank you so much for those explanations. I had suspected there might be some variables that were CDT-internal and 
some more Momentics IDE-specific, but I didn't know which were which. It seems it boils down to the path variables or 
more like how they're resolved by the IDE.
> 
> I've settled for this variant:
> ${ProjDirPath}/../TestLibrary/XMLParser
> 
> which I also prefer, since a colleague can import my project into any workspace and all he has to make sure is that /
Library and /Core are sibling directories.


That sounds good, yes.



> Now, there ARE some weird things going on, in my opinion...
> At first, it would work in the debug but not in the release version, even though I made exactly the same entries for 
both variants in the project options.


Hmmm ... that seems odd, as there really isn't any significant
difference between these configurations.  Most of the builder code
doesn't understand what these mean, and doesn't treat one any
differently than the other.



> So I removed all the includes, in both variants separately and even in the [All Configurations] variant. I closed the 
project properties dialog, and then opened it again and added the 2 library includes to the release version and compiled
 it. It works now.


The [All Configurations] is not a configuration.  It is a special view
in the dialog that presents a combination of the settings for all of the
project's confgurations (Debug, Release, Profile, Coverage).  Editing
all configurations can be confusing, especially when you're dealing with
multi-valued settings like include paths.  I don't recommend attempting
to modify such settings of multiple configurations at once.



> So I switch to the debug version and also add the includes and... it doesn't compile. Yes, I've tried Clean/Rebuild 
All.
> I get lots of "undefined reference to ..." errors.
> 
> I wonder if you can reproduce this behaviour on your computer. It would surely help you understand why I claim I'm 
losing my mind ;-)


Unsurprisingly, I am not able to reproduce this.  At least, not in the
current IDE development stream.

I removed all include paths in the compiler settings of each
configuration, and verified that the build fails.  Then, I added the
include paths to the Release config and it built.  Finally, I added the
same paths to the Debug config and it, too, built.



> The funny thing is: in all cases, if browse the includes in the Project Explorer, the paths are correct. So it IS 
resolving the path variables properly, right?
> 
> Also, I've noticed it DOES matter whether I enter my paths in the "C++ General>Paths and Symbols>Includes" or in the "
C++ Build>Settings>QCC Compiler>PreProcessor" tabs, even though their content is linked...
> For example, I enter "../Library" in the Paths and Symbols field, it will show up as 
> "../../Library" in the QCC Compiler settings.


I definitely recommend always using the "Build Settings" page for
include paths, macro definitions, etc.  The toolchain settings are
pushed (where appropriate) to the C/C++ Indexer and the "path entries"
framework that is managed in the "Paths and Symbols" page.  I would not
try editing these settings in both places.  The latter is best used only
for "standard make" projects (without the automatic makefile
generation).



> I even tried deleting the project files and creating a project file from scratch. 
> 
> I'm beginning to think I really have a buggy build of the IDE or something. Or would you say this behaviour is normal?
 I'm currently downloading build 20090510 and will try that.


That's the IDE 4.6 release build.  Which IDE release were using
previously?  IDE 4.6 picks up many fixes in Eclipse...
View Full Message
Re: IDE can't find my include directories anymore from time to time!  
Hello Christian

Thank you for your input!
 
> The [All Configurations] is not a configuration.  It is a special view
> in the dialog that presents a combination of the settings for all of the
> project's confgurations (Debug, Release, Profile, Coverage).  Editing
> all configurations can be confusing, especially when you're dealing with
> multi-valued settings like include paths.  I don't recommend attempting
> to modify such settings of multiple configurations at once.

Ok, thanks for clearing that up.
I'm used to be able to set values that apply to all configurations using this entry in the drop-down - a method I use to
 save time. Since this is how it works in Visual Studio, I obviously thought this applied too.
I will be careful to enter the settings separately from now on, to be on the safe side.


> > Also, I've noticed it DOES matter whether I enter my paths in the "C++ 
> > General>Paths and Symbols>Includes" or in the "C++ Build>Settings>QCC
> > Compiler
  
> I definitely recommend always using the "Build Settings" page for
> include paths, macro definitions, etc.  The toolchain settings are
> pushed (where appropriate) to the C/C++ Indexer and the "path entries"
> framework that is managed in the "Paths and Symbols" page.  I would not
> try editing these settings in both places.  The latter is best used only
> for "standard make" projects (without the automatic makefile
> generation).

Another thing I was completely unaware of. I thought this was just a different way of displaying the same data. I will 
try using only the "build settings"


> > I'm beginning to think I really have a buggy build of the IDE or something. 
> Or would you say this behaviour is normal? I'm currently downloading build 
> > 20090510 and will try that.
 
> That's the IDE 4.6 release build.  Which IDE release were using
> previously?  IDE 4.6 picks up many fixes in Eclipse CDT's project build
> infrastructure, which may have a lot to do with your problem.

I was previously using IDE version: 4.6.1 ,  Build id: I20091014 , which is indeed a later version than the release 
build, but I was not aware it was not an official  "release" version.

However, switchting to the new version did not help my pr


> > Another thing I've noticed, which might be an IDE bug:
> > 
> > In the project properties dialog, if I go to >C++ General>Paths and Symbols 
> > and I select [All Configurations], some things behave strangely (compared to 
> > when I select just "Debug" or "Release"):
> > 
> > * When I try to add a directory and click on Add>Variables, the window with 
> > the variables doesn't show up at all. 

> It looks like this problem no longer occurs in CDT 6.0.2 (included in
> the current IDE development stream).  Probably you will find it fixed in
> IDE 4.6 the that you have downloaded.

No, it still happens... This will no longer bug me if I don't use the [All configurations] option anymore (as per your 
suggestion). It's not intended behaviour, though, I presume.


I am currently working with an absolute path project... But I will give it another go with a fresh project using the 
release build IDE 4.6.0 and following your advice.


If you allow me some well-meant constructive IDE criticism:
 I'm probably not the only person having problems with these project properties settings. AFAIK, it's not really 
documented what the difference between the "build settings" and "paths and symbols" sections are. Also, the [all 
configurations] thing is not really intuitive.
If it wasn't for your help, I would have never guessed this could make a difference ;-)

Thanks again, and I'll keep you posted.

~Lorenz