Help with include
#1

Any ideas how could I include the file without changing the directories names?

this way is too long, mode is not reading the file.
Код:
#include "..\gamemodes\modules\fractions\firefighters\map.inc"
Reply
#2

Just use #include <yourinclude.inc>

Make sure the include is in pawno/includes/

Plus i still didn't get your question so apologize.
Reply
#3

Quote:
Originally Posted by Bingo
Посмотреть сообщение
Just use #include <yourinclude.inc>

Make sure the include is in pawno/includes/

Plus i still didn't get your question so apologize.
I'm including files from gamemode directory, not from pawno.
Reply
#4

Do you by any chance include another file (in any other folder) named "map"? If so, you have to remove include guards yourself
Reply
#5

Quote:
Originally Posted by Misiur
Посмотреть сообщение
Do you by any chance include another file (in any other folder) named "map"? If so, you have to remove include guards yourself
There are about 3 includes with "map.inc", but in different folders/path's
Reply
#6

That doesn't matter, they still have the same name "map.inc". To fix this, there are two steps.
1. Drop the .inc from your #include, like so: #include "path\map"
2. On top of each map.inc file, add this:
pawn Код:
#if defined _inc_map
    #undef _inc_map
#endif
Reply
#7

Quote:
Originally Posted by Misiur
Посмотреть сообщение
That doesn't matter, they still have the same name "map.inc". To fix this, there are two steps.
1. Drop the .inc from your #include, like so: #include "path\map"
2. On top of each map.inc file, add this:
pawn Код:
#if defined _inc_map
    #undef _inc_map
#endif
What about using .pwn instead of .inc?
Reply
#8

Then you'll hit this problem again, but you won't be able to remove the include guard. There's also third option exploting the compiler:
pawn Код:
#include "..\gamemodes\modules\fractions\firefighters/map"
Now the filename is "firefighters/map", so if all your other "map" includes are not in a firefighters folder (any, not necessarily this specific folder), then you are good to go. I won't recommend it as it can come back to haunt you, when one day you'll create a now module "stripclubs", in which there'll be "firefighters/map.inc" and you'll wonder why it is not included
Reply
#9

Quote:
Originally Posted by Bingo
Посмотреть сообщение
Just use #include <yourinclude.inc>

Make sure the include is in pawno/includes/

Plus i still didn't get your question so apologize.
There are multiple reasons why some people do not want to use this folder. For example if the compiler is not in the server folder but somewhere else on disk entirely (e.g. in program files). In that case you don't want to clutter the include folder with files that are only used by one specific mode.

The angle brackets denote a "system" file according to the documentation and I think a system file should be treated as such. A map file is not a system file and therefore shouldn't use the angle brackets.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)