DLS_James Posted January 4, 2017 Share Posted January 4, 2017 Hello, What is the correct syntax for an AND condition inside a conditional? I am trying to do the following: if ((OMEGA_POSITION / OMEGA_SCALER) > OMEGA_LOW_THRESHOLD) && ((OMEGA_POSITION / OMEGA_SCALER) < OMEGA_HIGH_THRESHOLD) { OMEGA_POSITION_OK = 1; } else { OMEGA_POSITION_OK = 0; } Related to this, is there a way of getting the pre-processor to tell you what error it sees? eg. With, projpp Error: projpp errors = 1 This message would be more helpful if it told you the error and which file and line number. Thanks for any help, James Link to comment Share on other sites More sharing options...
Omron Forums Support Posted January 4, 2017 Share Posted January 4, 2017 You want both conditions to be inside the outer most parenthesis of the if statement. if ((OMEGA_POSITION / OMEGA_SCALER > OMEGA_LOW_THRESHOLD) && (OMEGA_POSITION / OMEGA_SCALER < OMEGA_HIGH_THRESHOLD)) or if (OMEGA_POSITION / OMEGA_SCALER > OMEGA_LOW_THRESHOLD && OMEGA_POSITION / OMEGA_SCALER < OMEGA_HIGH_THRESHOLD) As far as the error message goes, usually if I double click on the error it puts me on the correct line of the correct file in the IDE. If double clicking doesn't work, could you give me a screenshot of the error? Link to comment Share on other sites More sharing options...
steve.milici Posted January 4, 2017 Share Posted January 4, 2017 The "&&" is the correct syntax for the logical "and" conditional combinatorial operator. You can view the errors in the "Error List" tab. When you double-click on an error it will open the source file in the editor window with the cursor at that position. Link to comment Share on other sites More sharing options...
DLS_James Posted January 5, 2017 Author Share Posted January 5, 2017 Thank you - the outer parentheses did the trick! Regarding the pre-processor error, I'm not using the IDE. I'm connecting using telnet and running the pre-processor from the command line (see screenshot). Can I get any useful error messages at this level? Link to comment Share on other sites More sharing options...
steve.milici Posted January 5, 2017 Share Posted January 5, 2017 The errors are in the project "Log" folder. Please note that we don't "officially" support usage of "projpp" outside of the IDE. Link to comment Share on other sites More sharing options...
Recommended Posts