I have struggling to figure out what has been causing this linking error and it has been driving me nuts. The error that comes out of Xcode is the following:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
Undefined symbols for architecture x86_64:
"Velocity::Velocity()", referenced from:
flyingObject::flyingObject() in rocks.o
flyingObject::flyingObject() in bullet.o
flyingObject::flyingObject() in ship.o
"typeinfo for Rock", referenced from:
typeinfo for BigRock in rocks.o
typeinfo for MediumRock in rocks.o
typeinfo for SmallRock in rocks.o
"vtable for Rock", referenced from:
Rock::Rock() in rocks.o
Rock::Rock(Rock const&) in game.o
NOTE: a missing vtable usually means the first non-inlinevirtual member function has no definition.
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
This is my header file that contains the only virtual function. Any help is appreciated!
Undefined symbols for architecture x86_64:
"Velocity::Velocity()", referenced from
This indicates that the constructor for a Velocity object cannot be found. Where is it? Your linker can't find it. If that function is in Velocity.cpp , then are you building that file into Velocity.o and are you feeding it to the linker?