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 Main (http://www.chiefdelphi.com/forums/showthread.php?t=155046)

sticksandbots 10-02-2017 15:01

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?

charlier999 10-02-2017 18:25

Re: Undefined Reference to Main
 
private: goes at the vary end of the robot code before START_ROBOT_CLASS(Robot)};
If that doesn't work then i have no clue.
Thx.

charlier999 10-02-2017 20:56

Re: Undefined Reference to Main
 
also put your code inside these tags
PHP Code:

.[CODE.] [./CODE

remove the . in /\ for it to work
there is also a button to do this when your writing the message above the text box
It looks like this \/


Thx.


All times are GMT -5. The time now is 20:22.

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