Jump to content
Developer Wiki and Function Reference Links ×

{$INCLUDE file}


Recommended Posts

Today I got an error because a missing INCLUDE file.

The situation is: I have to VSS that I use in other scripts.

But there is a function in VSS A that uses one of VSS B.

When I load both in a script, everything is fine.

But sometimes I do not need VSS B in the script and VS gives an error because VSS A needs it.

My question is:

Can you use {$INCLUDE file} in a VSS?

And if so, is it ok to include VSS B in VSS A and in the script?

Link to comment

If a piece in B is needed in A, why not move the piece to A and it will always be there when A is used (with or without B). As long as B loads after A (when you $Include B) all should be well, which assumes A is always there when B is used.

OR

If you you use both A & B independently, sometimes A, sometimes B and sometimes A & B, then remove the common part of B used in A and make a third $Include file with the common part and place it before A and/or B as:

{$Include 'CommonPart' }

{$Include 'A' }

or:

{$Include 'CommonPart' }

{$Include 'B' }

or:

{$Include 'CommonPart' }

{$Include 'A' }

{$Include 'B' }

Yes, you can have $Include files nested in other $Include files (I do it at least 3 files deep in my Reshaper program) but for the most part you will get name conflicts if you $Include the same file twice.

Remember, all $Include references are expanded before compiling begins. The result is one giant temporary text file with everything expanded. Any naming conflicts will kick an error.

My advice is do not use $Includes twice in your program, even though it is technically possible if great care is taken to avoid naming conflicts. Structure your program in the simplest fashion to avoid future headaches.

Raymond

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...