Weird compiling error messages

Hello All, I’ve been having some trouble verifying my code. I use my own library and so that might be the problem considering it is my first time.

Anyway, I keep getting this message:

planelib\plane.cpp.o: In function `myPlane::currentDeviation(char)':
D:\arduino-1.0.1\libraries\planelib/plane.cpp:102: multiple definition of `myPlane::currentDeviation(char)'
plane.cpp.o:C:\Users\Zachary\AppData\Local\Temp\build1680541222250280906.tmp/plane.cpp:99: first defined here
planelib\plane.cpp.o: In function `myPlane::velocityPlane(int)':
D:\arduino-1.0.1\libraries\planelib/plane.cpp:296: multiple definition of `myPlane::velocityPlane(int)'
plane.cpp.o:C:\Users\Zachary\AppData\Local\Temp\build1680541222250280906.tmp/plane.cpp:293: first defined here
planelib\plane.cpp.o: In function `myPlane::yawPlane(int)':
D:\arduino-1.0.1\libraries\planelib/plane.cpp:393: multiple definition of `myPlane::yawPlane(int)'
plane.cpp.o:C:\Users\Zachary\AppData\Local\Temp\build1680541222250280906.tmp/plane.cpp:390: first defined here
planelib\plane.cpp.o: In function `myPlane::getDirection(char)':
D:\arduino-1.0.1\libraries\planelib/plane.cpp:230: multiple definition of `myPlane::getDirection(char)'
plane.cpp.o:C:\Users\Zachary\AppData\Local\Temp\build1680541222250280906.tmp/plane.cpp:227: first defined here
planelib\plane.cpp.o: In function `myPlane::hasServoLimitsBeenMet(char)':
D:\arduino-1.0.1\libraries\planelib/plane.cpp:195: multiple definition of `myPlane::hasServoLimitsBeenMet(char)'
plane.cpp.o:C:\Users\Zachary\AppData\Local\Temp\build1680541222250280906.tmp/plane.cpp:192: first defined here
planelib\plane.cpp.o: In function `myPlane::Rudder(char, int)':
D:\arduino-1.0.1\libraries\planelib/plane.cpp:173: multiple definition of `myPlane::Rudder(char, int)'
plane.cpp.o:C:\Users\Zachary\AppData\Local\Temp\build1680541222250280906.tmp/plane.cpp:170: first defined here
planelib\plane.cpp.o: In function `myPlane::Elevator(char, int)':
D:\arduino-1.0.1\libraries\planelib/plane.cpp:151: multiple definition of `myPlane::Elevator(char, int)'
plane.cpp.o:C:\Users\Zachary\AppData\Local\Temp\build1680541222250280906.tmp/plane.cpp:148: first defined here
planelib\plane.cpp.o: In function `myPlane::Aileron(char, int)':
D:\arduino-1.0.1\libraries\planelib/plane.cpp:124: multiple definition of `myPlane::Aileron(char, int)'
plane.cpp.o:C:\Users\Zachary\AppData\Local\Temp\build1680541222250280906.tmp/plane.cpp:121: first defined here
planelib\plane.cpp.o: In function `myPlane::Trim(char)':
D:\arduino-1.0.1\libraries\planelib/plane.cpp:29: multiple definition of `myPlane::Trim(char)'
plane.cpp.o:C:\Users\Zachary\AppData\Local\Temp\build1680541222250280906.tmp/plane.cpp:26: first defined here
planelib\plane.cpp.o: In function `myPlane::pitchPlane(int)':
D:\arduino-1.0.1\libraries\planelib/plane.cpp:347: multiple definition of `myPlane::pitchPlane(int)'
plane.cpp.o:C:\Users\Zachary\AppData\Local\Temp\build1680541222250280906.tmp/plane.cpp:344: first defined here
planelib\plane.cpp.o: In function `myPlane::rollPlane(int)':
D:\arduino-1.0.1\libraries\planelib/plane.cpp:298: multiple definition of `myPlane::rollPlane(int)'
plane.cpp.o:C:\Users\Zachary\AppData\Local\Temp\build1680541222250280906.tmp/plane.cpp:295: first defined here
planelib\plane.cpp.o: In function `myPlane::Move(int, int, int, int, int)':
D:\arduino-1.0.1\libraries\planelib/plane.cpp:17: multiple definition of `myPlane::Move(int, int, int, int, int)'
plane.cpp.o:C:\Users\Zachary\AppData\Local\Temp\build1680541222250280906.tmp/plane.cpp:14: first defined here
planelib\plane.cpp.o: In function `myPlane':
D:\arduino-1.0.1\libraries\planelib/plane.cpp:12: multiple definition of `myPlane::myPlane()'
plane.cpp.o:C:\Users\Zachary\AppData\Local\Temp\build1680541222250280906.tmp/plane.cpp:12: first defined here
planelib\plane.cpp.o: In function `myPlane':
D:\arduino-1.0.1\libraries\planelib/plane.cpp:12: multiple definition of `myPlane::myPlane()'
plane.cpp.o:C:\Users\Zachary\AppData\Local\Temp\build1680541222250280906.tmp/plane.cpp:12: first defined here
core.a(main.cpp.o): In function `main':
D:\arduino-1.0.1\hardware\arduino\cores\arduino/main.cpp:11: undefined reference to `setup'
D:\arduino-1.0.1\hardware\arduino\cores\arduino/main.cpp:14: undefined reference to `loop'

I had to attach my sketch because it was too long in the post.

As you can see, I have both loop() and setup() in my sketch. I’ve searched for solutions extensively, but to no avail. I’m hoping someone will be able to help me out.

Thanks!
Zachary

plane.ino (666 Bytes)

plane.cpp (12.8 KB)

plane.h (1.84 KB)

Plane myPlane();

This is NOT how to create an instance of the Plane class. Loose the parentheses. This is trying to call the myPlane function, which is certainly not what you want to do. You don't have a Plane class (in the files you provided).

It is typical for the class name and the file name to match. If the class is myPlane (which is not a good name for a class), then the files should be myPlane.h and myPlane.cpp.

It looks like you have a conflict involving files you did not post.

I have fixed all the errors you mentioned and the "multiple definition" error code has gone away. (I re-uploaded the new files in the original post) However, I still have this error message:

core.a(main.cpp.o): In function `main':
D:\arduino-1.0.1\hardware\arduino\cores\arduino/main.cpp:11: undefined reference to `setup'
D:\arduino-1.0.1\hardware\arduino\cores\arduino/main.cpp:14: undefined reference to `loop'

Thanks, Zachary

void setup( void ) {

You may not think that the void in the parentheses matters. The compiler does.

Actually, that was an attempt to fix the problem. I took the "void" in parentheses out and it doesn't change anything. Any chance deleting the .o files will help? If so, how can I do this? I can't seem to see them in the folders even though I have enabled seeing hidden files and folders on my computer.

Zachary

I took the latest code you posted, changed the #include statement in the sketch to use “” instead of <>, and changed plane.h to Plane.h, since I made the file names match the class name.

I got a boatload of errors, complaining about:

minAileronServoLimit  = 20;
maxAileronServoLimit  = 20;
aileronResetAngle     = 40;

minElevatorServoLimit = 20;
maxElevatorServoLimit = 20;
elevatorResetAngle    = 40;

minRudderServoLimit   = 20;
maxRudderServoLimit   = 20;
rudderResetAngle      = 40;

hasServoLimitBeenMet = false;

startTimer = 0;
endTimer   = 0;

rollSpeed =  0;
pitchSpeed = 0;
yawSpeed =   0;

I deleted that crap, and then I got just one error:

Binary sketch size: 5172 bytes (of a 258048 byte maximum)

Doing the exact same thing you did did not change anything for me. Could this be a computer issue? I installed arduino on my D drive instead of my C drive.

Zachary

[quote author=arduino IDE] You can't have a .cpp file with the same name as the sketch. [/quote]

Thank you! I changed the name of the .cpp file to PlaneMethods.cpp and it worked after I made a couple other changes. Awesome!

Why can’t it be the same name, though?

Thanks again,
Zachary

Also, it doesn’t make much sense because a .ino file really is almost a c++ file and could have a .cpp extension.

WizenedEE: Also, it doesn't make much sense because a .ino file really is almost a c++ file and could have a .cpp extension.

It's not quite a CPP file because the Arduino IDE mangles it slightly to generate the CPP file that is actually compiled.