Book a Demo

Author Topic: c++ include paths  (Read 3123 times)

dwh

  • EA Novice
  • *
  • Posts: 5
  • Karma: +0/-0
    • View Profile
c++ include paths
« on: June 01, 2006, 10:48:36 am »
Two questions about generated include paths in c++.

First, is it possible to set the level of includes so that not every package is used to when creating include paths?

eg. if the project is organized like so:

   -model
   --P1
   --P2
   ---SP1a
   ---SP2a

And I want a class in SP2a to include a class in SP1a, the code is generated as follows:

Code: [Select]
#include "P2\SP1a\Class1a.h"

Would it be bossible to set P2 (or any other package) as the "root" for includes within that package, similar to how namespace roots are set?  Ideally if P2 is a namespace root, I would like the include to be simply:

Code: [Select]
#include "SP1a\Class1a.h"

This brings me to my Second question.  The path separator in the generated code does not work on systems other than windows.  Is it possible to change the '\' separator to '/' which works on windows and most other systems as well?

eg:

   #include "P2\SP1a\Class1a.h"

should be

   #include "P2/SP1a/Class1a.h"

Thanks
« Last Edit: June 01, 2006, 10:48:46 am by dwh »

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: c++ include paths
« Reply #1 on: June 01, 2006, 03:11:17 pm »
The only time that paths are used is when the target class of the include has a filename set with a local path.

eg. %MyLocalPath%P2\SPLa\Class1a.h
with %MyLocalPath% = C:\MySource\

If you modify the local path so that

%MyLocalPath% = C:\MySource\P2\
and the filename = %MyLocalPath%SPLa\Class1a.h

then this this should generate the relevant path that you want.

As for changing the slash direction, if you change it in the filename field then it should be generated in that form.

dwh

  • EA Novice
  • *
  • Posts: 5
  • Karma: +0/-0
    • View Profile
Re: c++ include paths
« Reply #2 on: June 01, 2006, 05:45:41 pm »
Okay, changing the local paths solved the package issue.

I'm not sure what you mean about changing the slash direction in the filename?

I can't change the slash direction in the local path, if I do, it doesn't apply the path. eg

   c:/mysource/package

does not equal

   c:\mysource\package


Is their a way to change the output in the code templates?

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: c++ include paths
« Reply #3 on: June 01, 2006, 06:58:19 pm »
I was actually suggesting you modify the filename after applying the local paths.

ie. Filename=%MyLocalPath%SPLa/Class1a.h

You could modify the code templates, but using the replace macro won't work so you would need to call an addin to modify it.

dwh

  • EA Novice
  • *
  • Posts: 5
  • Karma: +0/-0
    • View Profile
Re: c++ include paths
« Reply #4 on: June 02, 2006, 10:28:58 am »
Quote
I was actually suggesting you modify the filename after applying the local paths.
 
ie. Filename=%MyLocalPath%SPLa/Class1a.h

Okay, I tried that.  Unfortunately it did not fix the slash directions in the header files.  Furthermore, it broke the includes in the implementation files (the cpp file).  Where the implementation normally includes its header file is replaced by a blank include like so:

Code: [Select]
#include ""

I guess I don't understand what you said about modifying the code templates where #includes are generated.

Thanks.