How to have includes that depend on each other? (Modular programming)
#1

Hello, I'm having trouble with including files because they depend on each other. Instead of having all the code in one file I decided to split them up in multiple include files. So I have a main file called main.pwn and I'm trying to include 2 files called Events.inc and Player.inc.

But the problem is that Events.inc uses variables that were defined in Player.inc and Player.inc uses macro's that were defined in Events.inc. I know there's an easy fix for this, but I'm trying to split up the files according to their topic, and not their code type.

So no matter what I include first, there's always going to be a problem

Код:
#include "Models/Player.inc"
#include <NewEvents>
or

Код:
#include <NewEvents>
#include "Models/Player.inc"
Is there a way to fix this problem?
Reply
#2

Hahahaha

Dude hahah xD I have no words xD

There is only one solution, obviously xD

You have to decide which one you wanna include first.

And the part you need in the first one, you have to take out of the second one

#Fin
Reply
#3

Yeah, obviously lol. Go easy on me man I haven't done this in years
I was expecting some dark magic method that I've never heard about.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)