can be use directory in #include "folder/node.h"

I learn C++ for more than a year at university , and until now there is not everything that i know about C++ . This is my small question how to let the compiler know that the header is stored at different place folder any where on the harddisk ? .
I try and the compiler generates error . Althought it is minicule but it will help me to organize the header in order . Suppose that you have a lot of headers and all they present in a folder !!! amazing !
Any one can give me a word ! . Thank a lot !

Comments

  • Including a full path is naturally system specific, it is not specified by the C++ standard. The syntax you showed typically only works in unix. In Windows you would have to type something like #include ".\folder\node.h".

    However, every known IDE today handles paths for you. You can have the source code anywhere and include it in the project, and then the project managed function handles everything for you. This is to prefer, since it keeps the source code clean.
  • : In Windows you would have to type something like #include ".\folder\node.h".

    Alot of windows compilers (Borland builder, MSVC++ 2005 and 2008) that I use also seem to support the / syntax.


  • None of it is specified in the C standard though, so it is best to avoid the syntax entirely. Only thing the C standard says is that the symbol '' cant be in an #include directive. (Notice the difference between and \ in C).
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories