Conditional Compile Defines in .pjt file

A private (members-only) forum for discussing all issues related to the Beta test of Native mode devices.
Locked
Don_Kirby
Posts: 341
Joined: 15 October 2006, 3:48 AM
Location: Long Island, New York

Conditional Compile Defines in .pjt file

Post by Don_Kirby »

May or may not be a native mode problem here.

I have some conditional compile defines in my project file that don't seem to work. They don't produce any errors.

For example, in the project file:
--verbose
--allow-conditionals
-EnableOutput
Module1.bas
Module2.bas
And in Module1.bas:

Code: Select all

Sub Main()
...
#IfDef EnableOutput
#Notice Debug Output Enabled
'turn on a flag
...
#EndIf
End Sub
When compiled, I don't see the Notice, nor does the code (flag in this case) get executed. When the define is placed in the module, the operation is correct.

As a side note, are the defines case sensitive? It seems as they are, but in such a way that if I don't capitalize the first letter, I get an error from the compiler:

Code: Select all

Error: unrecognized option - "-outputenable"
  appeared on line 3 of file "definetest.pjt"
    invoked from command line
>Exit code: 1
-Don
dkinzer
Site Admin
Posts: 3120
Joined: 03 September 2005, 13:53 PM
Location: Portland, OR

Re: Conditional Compile Defines in .pjt file

Post by dkinzer »

Don_Kirby wrote:

Code: Select all

Error: unrecognized option - "-outputenable"
The syntax for defining a conditional symbol is

Code: Select all

-Doutputenable
I think that that change will resolve the problem.

By the way, the --enable-conditionals option has no bearing on this particular issue and, based on what I can see, its presence has no effect. The purpose of that option is to enable conditional constructs in a project file or arguments file. A conditional construct in the project or arguments file could be used to have certain files used or options in effect depending on a particular condition.

Conditional constructs are not enabled by default in these files because they are introduced by a pound sign which is a comment character in these files. If conditional constructs were enabled by default and you just happened to have a comment line that began with #if, a syntax error would likely result.
- Don Kinzer
Locked