显然,我认为我的makefile不能正常工作。 这是我的makefile:
LFLAGS = -lglut -lGLU -lGL
a.out: driver.o game.o uiInteract.o uiDraw.o point.o rifle.o bird.o bullet.o flyingObjects.o
g++ driver.o game.o uiInteract.o uiDraw.o point.o rifle.o bird.o bullet.o flyingObjects.o $(LFLAGS)
uiDraw.o: uiDraw.cpp uiDraw.h point.h
g++ -c uiDraw.cpp
uiInteract.o: uiInteract.cpp uiInteract.h
g++ -c uiInteract.cpp
point.o: point.cpp point.h
g++ -c point.cpp
game.o: game.cpp uiDraw.h uiInteract.h point.h rifle.h bullet.h bird.h flyingObjects.h velocity.h
g++ -c game.cpp
driver.o: game.h uiInteract.h driver.cpp
g++ -c driver.cpp
rifle.o: rifle.h point.h uiDraw.h rifle.cpp
g++ -c rifle.cpp
bird.o: bird.h bird.cpp velocity.h point.h uiDraw.h
g++ -c bird.cpp
bullet.o: bullet.h bullet.cpp point.h velocity.h uiDraw.h
g++ -c bullet.cpp
flyingObjects.o: flyingObjects.h flyingObjects.cpp velocity.h point.h uiDraw.h
g++ -c flyingObjects.cpp
clean:
rm a.out *.o
当我输入make时,我在终端上收到了这个:
g++ driver.o game.o uiInteract.o uiDraw.o point.o rifle.o bird.o bullet.o flyingObjects.o -lglut -lGLU -lGL
game.o: In function `FlyingObjects::FlyingObjects()':
game.cpp:(.text._ZN13FlyingObjectsC2Ev[_ZN13FlyingObjectsC5Ev]+0x23): undefined reference to `velocity::velocity()'
bird.o: In function `Bird::Bird()':
bird.cpp:(.text+0x7d): undefined reference to `velocity::setDx(float)'
bird.cpp:(.text+0xbd): undefined reference to `velocity::setDy(float)'
bird.cpp:(.text+0xe2): undefined reference to `velocity::setDy(float)'
bird.o: In function `T_Bird::T_Bird()':
bird.cpp:(.text+0x197): undefined reference to `velocity::setDx(float)'
bird.cpp:(.text+0x20b): undefined reference to `velocity::setDy(float)'
bird.cpp:(.text+0x24f): undefined reference to `velocity::setDy(float)'
bullet.o: In function `Bullet::advance()':
bullet.cpp:(.text+0x82): undefined reference to `velocity::setDx(float)'
bullet.cpp:(.text+0xc6): undefined reference to `velocity::setDy(float)'
flyingObjects.o: In function `FlyingObjects::advance()':
flyingObjects.cpp:(.text+0x68): undefined reference to `velocity::getDx()'
flyingObjects.cpp:(.text+0x98): undefined reference to `velocity::getDy()'
collect2: error: ld returned 1 exit status
make: *** [a.out] Error 1
如果我尝试输入a.out或./a.out,这就是我得到的:
bash: a.out: command not found...
-bash: ./a.out: No such file or directory