open.mp forum
[Pawn] A weird problem with includes - Printable Version

+ open.mp forum (https://forum.open.mp)
-- Forum: SA-MP (https://forum.open.mp/forumdisplay.php?fid=3)
--- Forum: Pawn Scripting (https://forum.open.mp/forumdisplay.php?fid=10)
--- Thread: [Pawn] A weird problem with includes (/showthread.php?tid=719)



A weird problem with includes - mouiz - 2019-07-14

Quote:#include <../../gamemodes/modes/mode_robbery.pwn>

#include <../../gamemodes/modes/mode_dogfight.pwn>



These are ^ two includes in the 'gamemodes/modes' folder.





If i arrange them like this:?



Quote:#include <../../gamemodes/modes/mode_dogfight.pwn>

#include <../../gamemodes/modes/mode_robbery.pwn>



the 'mode_dogfight' works (gets included)?and the second one is ignored (it shows undefined symbol errors since the definitions of the functions are in the include)



If i arrange them oppositely then the 'mode_robbery' works, the second one is ignore.



How can i fix this?


RE: A weird problem with includes - Manyula - 2019-07-14

Try using



Code:
#include "..."



instead of



Code:
#include <...>



RE: A weird problem with includes - mouiz - 2019-07-14

Does not work either way :/


RE: A weird problem with includes - mouiz - 2019-07-14

When i put the 'mode_dogfight.pwn' in the pawno > include folder and change the path in the script, it works but i want it to be in the gamemodes folder...


RE: A weird problem with includes - Freaksken - 2019-07-14

The updated version of the compiler fixes that problem:
https://github.com/pawn-lang/compiler/releases

You can read more about the fix here:
https://github.com/pawn-lang/compiler/wiki/File-Inclusion#long-paths


RE: A weird problem with includes - Y_Less - 2019-07-14

Also, use \ not /


RE: A weird problem with includes - mouiz - 2019-07-14

Ok, thanks both


RE: A weird problem with includes - dakyskye - 2019-07-17

That's because you are on Windows and use wrong directory separator. On Windows, it is \??while on Unix and unix-like systems it's /

A trick: always use \ even while not on Windows and compile with -Z which is for compatibility and changes \ to / automatically on non-Windows platforms.