View Single Post
Old 27/02/2020, 01:43 PM   #4
Nero_3D
High-roller
 
Nero_3D's Avatar
 
Join Date: Jun 2007
Location: Germany
Posts: 2,850
Reputation: 675
Default Re: #include doesn't include

you could create a list file (-l in the compiler option) and see what the preprocessor does

but I think your problem is that you use forward slashes and the default compiler
Quote:
Originally Posted by ColeMiner View Post
I suspect this is something to do with the length:

pawn Code:
_inc_files/scripts/staff/genera

As the include-guard would be called when using forward slashes (not a valid name, but that's the problem with forward slashes) is 31 characters. When using "\" the separators are correctly identified and you get this:

pawn Code:
_inc_general

Thus, if you have another file called "general" in another folder, this one won't get included because the compiler thinks it already has been. This sounds like the best candidate for the problem (ignore what I started saying about length) - it MAY crash if you include code here that is needed, but it doesn't get included because of the mix-up with include guards.

I don't always recommend using "\" for exactly this reason - which to use varies by use-case. In your case you may want to instead use "/" since it worked anyway (just be aware of long directory chains).

Zeex's compiler doesn't automatically generate include guards so this won't be a problem there, but that can cause other issues if your files don't contain explicit include guards as required.
Nero_3D is offline   Reply With Quote