View Single Post
  #1   Spotlight this post!  
Unread Yesterday, 15:01
sticksandbots sticksandbots is offline
Registered User
FRC #2437
 
Join Date: Feb 2017
Location: Hawaii
Posts: 1
sticksandbots is an unknown quantity at this point
Exclamation Undefined Reference to Main

I'm new to C++ and am learning things on my own. I'm currently wondering why our code won't build and deploy to our RoboRIO. We've tried using different computers but nothing seems to do and we end up with the same error of having an Undefined Reference to Main. Here's our code:

#include <IterativeRobot.h>
#include <Joystick.h>
#include <LiveWindow/LiveWindow.h>
#include <RobotDrive.h>
#include <Timer.h>
#include <WPILib.h>

class Robot: public frc::IterativeRobot {
public:
Robot() {
myRobot.SetExpiration(0.1);
drive = new RobotDrive(0,1); //2 motor drive
left = new Joystick(0);
right = new Joystick(1);
}

private:
frc::RobotDrive myRobot { 0, 1};
frc::Joystick stick { 0 };
frc::LiveWindow* lw = frc::LiveWindow::GetInstance();
frc::Timer timer;

RobotDrive *drive;
Joystick *left, *right;


void TeleopInit()
{
drive = new RobotDrive(0,1); //2 motor drive
left = new Joystick(0);
right = new Joystick(1);

}

void operatorControl() {
while (IsOperatorControl() & IsEnabled()) {
drive->TankDrive(left, right);
Wait(0.01);

}
};

START_ROBOT_CLASS(Robot)};


and here's our build console log:

09:44:18 **** Incremental Build of configuration Debug for project Getting Started ****
Info: Internal Builder is used for build
arm-frc-linux-gnueabi-g++ -std=c++1y "-IC:\\Users\\Peter Park/wpilib/cpp/current/include" "-IC:\\Users\\Peter Park\\workspace\\Getting Started\\src" "-IC:\\Users\\Peter Park/wpilib/user/cpp/include" -O0 -Og -g3 -Wall -c -fmessage-length=0 -o "src\\Robot.o" "..\\src\\Robot.cpp"
arm-frc-linux-gnueabi-g++ "-LC:\\Users\\Peter Park/wpilib/cpp/current/lib" "-LC:\\Users\\Peter Park/wpilib/user/cpp/lib" -Wl,-rpath,/opt/GenICam_v3_0_NI/bin/Linux32_ARM -o FRCUserProgram "src\\Robot.o" -lwpi
c:/frc/bin/../../frc/usr/lib/crt1.o: In function `_start':
/mnt/build/perforce/ThirdPartyExports/NIOpenEmbedded/trunk/4.0/objects/targettools/linuxU/armv7-a/gcc-4.7-oe/release/build/tmp-glibc/work/cortexa9-vfpv3-nilrt-linux-gnueabi/glibc/2.21-r0/git/csu/../sysdeps/arm/start.S:119: undefined reference to `main'
collect2.exe: error: ld returned 1 exit status

09:44:24 Build Finished (took 6s.622ms)

Can anyone find mistakes or suggest something?
Reply With Quote