Constructing #include file name

As I understand there is no way to build/construct filename that is used in #include simply because #include is a pre-processor command and happens before formula is executed. Something like this can, I guess, never work:

rootFolder = "C:\\tmp\\";
includeFolder = "include";
includeFileName = "include.afl";
includeFileName = rootFolder + "\\" + includeFolder  + "\\" + includeFileName ;
_TRACE(includeFileName);

#include includeFileName;

_TRACE("Seems Include is working because no error, but, in fact, nothing is being included form the file...");

Or am I mistaken and there is some workaround to achieve this?

This will not work because #include is PREprocessor command and is expanded BEFORE your code is even parsed.

See C preprocessor - Wikipedia for more info.

This topic was automatically closed 100 days after the last reply. New replies are no longer allowed.