Anteckning
Åtkomst till den här sidan kräver auktorisering. Du kan prova att logga in eller ändra kataloger.
Åtkomst till den här sidan kräver auktorisering. Du kan prova att ändra kataloger.
Defines conditional compiler constants.
/define:["]symbol[=value][,symbol[=value]]["]
' -or-
/d:["]symbol[=value][,symbol[=value]]["]
Arguments
Term |
Definition |
symbol |
Required. The symbol to define. |
value |
Optional. The value to assign symbol. If value is a string, it must be surrounded by backslash/quotation-mark sequences (\") instead of quotation marks. If no value is specified, then it is taken to be True. |
Remarks
The /define option has an effect similar to using a #Const preprocessor directive in your source file, except that constants defined with /define are public and apply to all files in the project.
You can use symbols created by this option with the #If...Then...#Else directive to compile source files conditionally.
/d is the short form of /define.
You can define multiple symbols with /define by using a comma to separate symbol definitions.
To set /define in the Visual Studio integrated development environment |
|
Example
The following code defines and then uses two conditional compiler constants.
' Vbc /define:DEBUGMODE=True,TRAPERRORS=False test.vb
Sub mysub()
#If debugmode Then
' Insert debug statements here.
MsgBox("debug mode")
#Else
' Insert default statements here.
#End If
End Sub
See Also
Reference
Sample Compilation Command Lines (Visual Basic)