Dieter @ DWorks Posted November 22, 2007 Share Posted November 22, 2007 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? Quote Link to comment
MullinRJ Posted November 22, 2007 Share Posted November 22, 2007 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 Quote Link to comment
Dieter @ DWorks Posted November 22, 2007 Author Share Posted November 22, 2007 thx for the reaction. I get it now. So I should always include A even if I do not use it because include file B is referencing to it. Quote Link to comment
Recommended Posts
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.