SA-MP Forums Archive
Function not found using #include's - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Function not found using #include's (/showthread.php?tid=611654)



Function not found using #include's - SomebodyAndMe - 09.07.2016

Hello,

For readability in a fair big gamemode I've decided to split up all my functions etc, in different files as includes.

Now there's a function that it cannot find even though it is included.

Includes for the files.
pawn Код:
// Settings
#include <settings\variables>
#include <settings\config>
#include <settings\dialogs>

// Data
#include <data\common>
#include <data\datastructure>
#include <data\missions>
#include <data\dealerships>

// Functions
#include <functions\default>
#include <functions\loadall>
#include <functions\missions>
#include <functions\commands>
Function it cannot find:
Код:
C:\Users\Kevin\Dropbox\pawn\pawno\include\functions\commands.inc(837) : error 017: undefined symbol "StartMission"
But what is weird is that it's just in the data\missions.inc:

pawn Код:
forward StartMission(playerid, type);
public StartMission(playerid, type)
So to make things a little more clear:

- data\missions is called before functions\commands.
- StartMission is forwarded as a function.

Any help would be greatly appreciated!


- Thanks for looking into it!


Re: Function not found using #include's - Nero_3D - 09.07.2016

I think you will solve the problem if you use forward slashes '/' instead of back slashes
The reason is that the compiler prevents that you include the same filename "missions" again


Re: Function not found using #include's - SomebodyAndMe - 09.07.2016

Renamed the include and that worked, thanks alot!


Re: Function not found using #include's - PrO.GameR - 09.07.2016

On a side note thats a really bad code structure, You need to split your code by functionality, I.E house,job,vehicle,bizz and etc. not by their type as in data, functions, defines, variables.


Re: Function not found using #include's - SomebodyAndMe - 09.07.2016

So in your example you'd do it like this:

Houses -> Functions.inc, Data.inc, etc,etc?

That could also be a structure. But it still is a personal matter on which you are the most comfortable with.

Thanks for the input though!


Re: Function not found using #include's - PrO.GameR - 09.07.2016

Ofc it's a personal choice to which you choose, but yeah the other way around would be actually both easier to read and solve problems on

This is my suggestion for you to try, this would be the structure of all individual systems in your files.
PHP код:
//defines n settings
//variables and static data arrays
//native callbacks
//custom callbacks
//commands
//functions