Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   C/C++ (http://www.chiefdelphi.com/forums/forumdisplay.php?f=183)
-   -   Double Solenoid error in Eclipse (http://www.chiefdelphi.com/forums/showthread.php?t=133369)

BananaKing1378 22-01-2015 22:46

Double Solenoid error in Eclipse
 
Hello! We are currently trying to set up a double acting solenoid in Eclipse.

First we create a DoubleSolenoid called Solenoid with the following line:
DoubleSolenoid Solenoid;

Next we construct it:
Solenoid(0,1);

Next, we try to set the Solenoid to forward. This is where the problem occurs. We are told that there is no member named "Forward". We have tried various ways of calling "set". Currently, we are using:

Solenoid.Set(DoubleSolenoid::kForward);

GeeTwo 22-01-2015 23:08

Re: Double Solenoid error in Eclipse
 
Quote:

Originally Posted by BananaKing1378 (Post 1432466)
Hello! We are currently trying to set up a double acting solenoid in Eclipse.

First we create a DoubleSolenoid called Solenoid with the following line:
DoubleSolenoid Solenoid;

Next we construct it:
Solenoid(0,1);

Next, we try to set the Solenoid to forward. This is where the problem occurs. We are told that there is no member named "Forward". We have tried various ways of calling "set". Currently, we are using:

Solenoid.Set(DoubleSolenoid::kForward);

Sounds like you're using C++, since :: is not part of java.

Doing a bit of googling, I found that kForward is actually a member of the class "Value" defined within DoubleSolenoid. I have never written any c++, but as I read the docs online, my best guess at this line would be:
Solenoid.Set(DoubleSolenoid::Value.kForward);

Alan Anderson 23-01-2015 11:25

Re: Double Solenoid error in Eclipse
 
Quote:

Originally Posted by BananaKing1378 (Post 1432466)
DoubleSolenoid Solenoid;

Just a thought -- is the name "Solenoid" conflicting with a library class name? Pick something a little more descriptive, like "gearselect" or "toteflipper" and see if the error remains.

JefferMC 25-01-2015 17:33

Re: Double Solenoid error in Eclipse
 
Quote:

Originally Posted by GeeTwo (Post 1432478)
Sounds like you're using C++, since :: is not part of java.

Doing a bit of googling, I found that kForward is actually a member of the class "Value" defined within DoubleSolenoid. I have never written any c++, but as I read the docs online, my best guess at this line would be:
Solenoid.Set(DoubleSolenoid::Value.kForward);

Close, "Value." isn't necessary, the correct parameter value would be:

DoubleSolenoid::kForward

Keep in mind that if you should be able to type DoubleSolenoid, the two colons and pause, Elipse should list members of DoubleSolenoid for you. I believe the constants appear near the end.

bob.wolff68 28-01-2015 01:26

Re: Double Solenoid error in Eclipse
 
I'm voting with Alan on this one - change the name of your 'variable' Solenoid to something else. Both of those names are class names. That could be problematic.


All times are GMT -5. The time now is 12:00.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi