Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   C/C++ (http://www.chiefdelphi.com/forums/forumdisplay.php?f=183)
-   -   Undefined Reference to CANTalon::CANTalon(int) (http://www.chiefdelphi.com/forums/showthread.php?t=153542)

CSkillet 12-01-2017 17:09

Undefined Reference to CANTalon::CANTalon(int)
 
Hello,
I have been having an issue creating a pointer of the CANTalon class in Eclipse C++. I am aware that there is a CTRE Toolsuite (currently v4.4.1.8), and have downloaded and installed it. I made sure that the class files are in the correct location on my computer. There is no error in including the CANTalon class in the .h file of the subsystem I'm using.

I created the pointer according to WPI Lib Screensteps, and Eclipse comes up with the error "Undefined Reference to CANTalon::CANTalon(int)." In the .h, I put CANTalon* shooterMotor; and in the .cpp I put shooterMotor = new CANTalon(11); . When I type the code in the .cpp, the "helper" points out that I should input an integer for a parameter, but after building, it comes up with this error.

I have tried many variations of creating a pointer of CANTalon but all with no luck. I have also tried on two different computers, both with the same errors. I was wondering if maybe there was a problem with the Toolsuite itself, but obviously if no one else has posted a problem about this, then there's not.

Any help is appreciated.

Conner

Jacob C. 12-01-2017 21:34

Re: Undefined Reference to CANTalon::CANTalon(int)
 
Conner,

It sounds like it can't find the static library file.

I was able to replicate your issue by removing the library from the build arguments. The header file is still included properly but it won't compile because it can't find any of the actual function definitions.

This may sound like a trivial thing, but have you re-started Eclipse since you installed the Toolsuite? When Eclipse is opened it checks the user locations for libraries and includes them in the build arguments; If this hasn't happened, then it won't even be looking for the library file and won't link it in, resulting in the issue you're seeing.

CSkillet 13-01-2017 13:47

Re: Undefined Reference to CANTalon::CANTalon(int)
 
Yes, I tried that and it cleared that error. I was able to upload the code to the RoboRIO, but the Talon does not seem to run when I tell it to run in the code. The lights on the Talon blink orange, which indicates that it is disabled, however, when I enabled that robot through the driver station, the LEDs are still blinking orange.

In the NI Web-based software, I looked at what happened to the Talon when it was enabled. It goes from Mode 15: No Drive to Mode 0: Throttle.

I am receiving one error from the Driver Station - NIFPGA: Resource Not Initialized - GetFPGATime[Utility.cpp.171]

bob.wolff68 13-01-2017 17:14

Re: Undefined Reference to CANTalon::CANTalon(int)
 
Glad you were able to get rid of the library error.

As for this issue, this is a little harder to diagnose without some other insights. I would suggest possibly starting with either uploading your code for others to reference here - or on pastebin.com or something ... or a way to diagnose for yourself would be to create one of the sample/example projects and see if it works. If it doesn't, then it's likely you have a hardware setup issue of some kind (or firmware that needs updated).

File->New->Other->WPI Robot->Example... "Motor Controller" would be my suggestion - it requires a joystick and a speed controller at a minimum. Tweak the sample to your channel number (11?) and see what it does or doesn't do. If it does work, then we're back to your code as next steps.


All times are GMT -5. The time now is 13:31.

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