Go to Post There are few things I hate more in life than electrical tape residue. - AdamHeard [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 24-01-2015, 17:55
playerzero playerzero is offline
Registered User
FRC #0167
 
Join Date: Jan 2014
Location: Iowa
Posts: 2
playerzero is an unknown quantity at this point
Eclipse C++ undefined reference to main

Hi,

My team (Team 167) is having a rather cryptic issue when attempting to compile our C++ program in Eclipse. The build console shows this:

16:51:03 **** Incremental Build of configuration Debug for project icrobotics-2015 ****
Info: Internal Builder is used for build
arm-frc-linux-gnueabi-g++ "-LC:\\Users\\Kazimier/wpilib/cpp/current/lib" -Wl,-rpath,/opt/GenlCam_v2_3/bin/Linux_armv7-a -o FRCUserProgram "src\\Team167Lib\\Vector3.o" "src\\Team167Lib\\SwerveDrive.o" "src\\Team167Lib\\SimpleJoystick.o" "src\\Team167Lib\\PneumaticPiston.o" "src\\Robot.o" "src\\ElevatorArms.o" "src\\Autonomous.o" -lwpi
c:/frc/bin/../lib/gcc/arm-frc-linux-gnueabi/4.9.1/../../../../arm-frc-linux-gnueabi/bin/ld.exe: warning: libstdc++.so.6, needed by C:\Users\Kazimier/wpilib/cpp/current/lib\libFRC_NetworkCommunication.so.1.5.0, not found (try using -rpath or -rpath-link)
c:/frc/bin/../../frc/usr/lib/crt1.o: In function `_start':
/builds/perforce/ThirdPartyExports/NIOpenEmbedded/trunk/2.0/objects/targettools/linuxU/armv7-a/gcc-4.7-oe/release/build/tmp-eglibc/work/armv7a-vfp-neon-nilrt-linux-gnueabi/eglibc/2.17-r4/eglibc-2.17/libc/csu/../ports/sysdeps/arm/start.S:119: undefined reference to `main'
collect2.exe: error: ld returned 1 exit status

16:51:06 Build Finished (took 2s.665ms)

The important part (I think) is:
c:/frc/bin/../../frc/usr/lib/crt1.o: In function `_start':
/builds/perforce/ThirdPartyExports/NIOpenEmbedded/trunk/2.0/objects/targettools/linuxU/armv7-a/gcc-4.7-oe/release/build/tmp-eglibc/work/armv7a-vfp-neon-nilrt-linux-gnueabi/eglibc/2.17-r4/eglibc-2.17/libc/csu/../ports/sysdeps/arm/start.S:119: undefined reference to `main'
collect2.exe: error: ld returned 1 exit status


I guess some program on which our code relies is trying to call a main method when it shouldn't. Supposedly the "-c" compile option can help with this, but it's already set in the g++ compiler options in Eclipse.

I'm kind of at a loss as to how to fix the issue. I'm wondering if I set up Eclipse wrong. Has anyone else experienced or managed to fix this error? Does anyone have any ideas as to how I might fix it or even what the specific problem is?

Thank you!
Reply With Quote
  #2   Spotlight this post!  
Unread 25-01-2015, 15:23
mandrews281 mandrews281 is offline
Registered User
FRC #0281
Team Role: Mentor
 
Join Date: Jan 2007
Rookie Year: 2006
Location: Greenville SC
Posts: 82
mandrews281 is a splendid one to beholdmandrews281 is a splendid one to beholdmandrews281 is a splendid one to beholdmandrews281 is a splendid one to beholdmandrews281 is a splendid one to beholdmandrews281 is a splendid one to beholdmandrews281 is a splendid one to behold
Re: Eclipse C++ undefined reference to main

Make sure you have the line:

START_ROBOT_CLASS(Robot);

in the file where you are implementing the RobotInit, DisabledInit ... methods. The name in the parens should match the class name you use for inheriting from IterativeRobot.
__________________
Michael Andrews
Team #281 Programming Mentor
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:57.

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