Compiler-Specific code

Hello,
I was wondering if there is non-standard code in C++ supported by only some compilers, specifically something like this:
 
#include "header1/header2/header3.h" 

If so (I'm assuming it works because it's in a project) does anyone know what compiler(s) support this?

Thanks,

enduser000
Sorry, I'm not sure what you're trying to do - if you are trying to access a header file from within folders then yes, that's fine.
Yes, that syntax is acceptable to every compiler I've ever used. However if your compiler is complaining that it can't find the header file header3.h, then either the file doesn't exist, or it doesn't know where to find the directory header1.
Last edited on
The problem is often where your compiler's vendor (or your sysadmin) keeps include files. Outside of ISO standard includes, there is no specific place to keep them.

For example, the SDL library is available on (nearly) every platform, but where its header files are put is different on nearly every platform. Which is truly obnoxious...

So while the #include syntax doesn't change, what exactly you #include can cause grief. In the case of SDL, the recommended include is
#include "SDL/SDL.h"
Thereafter it can be made to compile on every platform without the need to change the source code --instead you change the way the compiler is called. I've installed SDL in my compiler's default include and lib paths, so I don't need to do anything special for it to find the include and library files. On other systems it might be necessary to use the -I and -L command-line options.

In short, it depends on the compiler.
Topic archived. No new replies allowed.