Page MenuHomeFeedback Tracker

I cannot include a file from another folder in my CfgFunctions function file
Closed, ResolvedPublic


I am trying to slowly adopt the CfgFunctions method and I came accross a limitation.

I cannot have a definitions file:
[mission root folder]\definitions\definitions_1.ext

and a CfgFunctions compliant function file:
[mission root folder]\functions\default\fn_myfunc_1.sqf

where fn_myfunc_1.sqf contains:
#include "definitions\definitions_1.ext"

... because Arma will crash.

Is there any way that I can do this without making full copies of the definitions file and keeping the same folder structure?


Legacy ID
Feature Request

Event Timeline

d3nn16 set Category to Feature Request.May 17 2015, 7:48 PM
d3nn16 set Reproducibility to N/A.
d3nn16 set Severity to None.
d3nn16 set Resolution to Fixed.
d3nn16 set Legacy ID to 478627650.May 8 2016, 12:06 PM
Adam added a comment.May 18 2015, 8:05 AM

Hello, could you please try the solution that Waffle has posted above and see if it works? Thank you.

Misunderstood issue. He's requesting more advanced #include preProcessor support for CfgFunction functions. Currently #include will only include a file that can be found within the function's directory. He's requesting the ability to search for files lower in the directory tree.

d3nn16 added a subscriber: d3nn16.May 8 2016, 12:06 PM

I was thinking about something like I am already using:

  • I define functions in some files
  • I include all these files in the init.sqf (with #include)
  • Before the inclusion of function files, I include all definition files (eg the ones containing #define blabla or even other #include)

This way I don't care where the definition file is located since it is included in the init.sqf and all file paths are visible at this level.

So I am asking whether this can be achieved with CfgFunctions.

One example is that I have a list of colors as #define in a file ([root]\colors.ext and I want to use this in [root]\functions\fn_myfunc.sqf and also other scripts that i don't want to place in same folder as fn_myfunc.sqf but sth like [root]\mygreatscript\toto.sqf. At the moment I'm forced to cpy the colors.ext file in [root]\mygreatscript\ and [root]\functions\.

You can create a function to act the same as a #include

I don't see how to do that (please give an example).
Do you mean I should use variables instead of #define? If yes then I will still have to use 2 files colors.ext (with #define, used in dialogs) and color.sqf (with variables used in sqf scripts).
Also my point was to use #define for all variables that are static.

The status of this ticket is incorrect because I already provided more informations