Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   C/C++ (http://www.chiefdelphi.com/forums/forumdisplay.php?f=183)
-   -   Eclipse C++ undefined reference to main (http://www.chiefdelphi.com/forums/showthread.php?t=133466)

playerzero 24-01-2015 17:55

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!

mandrews281 25-01-2015 15:23

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.


All times are GMT -5. The time now is 12:02.

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