Go to Post If there's one bit of advice I can give, its never underestimate the power of a hurricane. - Joshua May [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 10-02-2017, 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
  #2   Spotlight this post!  
Unread 10-02-2017, 18:25
charlier999's Avatar
charlier999 charlier999 is offline
Registered User
FRC #1662 (Raptor Force Engineering)
Team Role: Programmer
 
Join Date: Feb 2017
Rookie Year: 2013
Location: Lodi, CA
Posts: 19
charlier999 is an unknown quantity at this point
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.
Reply With Quote
  #3   Spotlight this post!  
Unread 10-02-2017, 20:56
charlier999's Avatar
charlier999 charlier999 is offline
Registered User
FRC #1662 (Raptor Force Engineering)
Team Role: Programmer
 
Join Date: Feb 2017
Rookie Year: 2013
Location: Lodi, CA
Posts: 19
charlier999 is an unknown quantity at this point
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.
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 03:22.

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