Go to Post Leave FIRST? That's an option? =) - treffk [more]
Home
Go Back   Chief Delphi > Technical > Programming > C/C++
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
 
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 12-01-2017, 17:09
CSkillet CSkillet is offline
Registered User
FRC #0135
 
Join Date: Jan 2016
Location: Indiana
Posts: 11
CSkillet is an unknown quantity at this point
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
Reply With Quote
  #2   Spotlight this post!  
Unread 12-01-2017, 21:34
Jacob C. Jacob C. is offline
Engineer at CTR Electronics
FRC #4130 (The Blue Devils)
Team Role: Mentor
 
Join Date: Nov 2009
Rookie Year: 2009
Location: Richmond, MI
Posts: 21
Jacob C. is a glorious beacon of lightJacob C. is a glorious beacon of lightJacob C. is a glorious beacon of lightJacob C. is a glorious beacon of lightJacob C. is a glorious beacon of light
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.
__________________
FiM Volunteer
Since 2015: Controls Mentor for FRC 4130, The Blue Devils (Richmond, MI)
2009-2014: FRC Team 1718, The Fighting Pi

Full Disclosure: I am an Engineer for CTR Electronics
Reply With Quote
  #3   Spotlight this post!  
Unread 13-01-2017, 13:47
CSkillet CSkillet is offline
Registered User
FRC #0135
 
Join Date: Jan 2016
Location: Indiana
Posts: 11
CSkillet is an unknown quantity at this point
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]
Reply With Quote
  #4   Spotlight this post!  
Unread 13-01-2017, 17:14
bob.wolff68's Avatar
bob.wolff68 bob.wolff68 is offline
Da' Mentor Man
FRC #1967
Team Role: Mentor
 
Join Date: Jan 2012
Rookie Year: 2007
Location: United States
Posts: 158
bob.wolff68 is just really nicebob.wolff68 is just really nicebob.wolff68 is just really nicebob.wolff68 is just really nicebob.wolff68 is just really nice
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.
__________________
~~~~~~~~~~~~~~~~~~~
Bob Wolff - Software from the old-school
Mentor / C / C++ guy
Team 1967 - The Janksters - San Jose, CA
Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


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

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


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