使用MinGW在eclipse中构建box2d测试平台应用程序

时间:2012-01-12 17:20:42

标签: c++ eclipse mingw box2d freeglut

这篇文章:How would I build Box2D to work in Code::Blocks/Mingw32(Windows)和这个网站:http://www.transmissionzero.co.uk/computing/using-glut-with-mingw/在我尝试使用MinGW GCC工具链和Gnu Make构建器从eclipse中构建Box2D测试平台时有很多帮助,但我' m仍然在链接阶段遇到未定义的引用错误:

make all 
Building target: PhysInvent.exe
Invoking: MinGW C++ Linker
g++ -L../../PhysInvent/libs -o "PhysInvent.exe"  ./include/glui/algebra3.o ./include 
/glui/arcball.o ./include/glui/glui.o ./include/glui/glui_add_controls.o ./include
/glui/glui_bitmap_img_data.o ./include/glui/glui_bitmaps.o ./include 
/glui/glui_button.o 
./include/glui/glui_checkbox.o ./include/glui/glui_column.o ./include
/glui/glui_commandline.o ./include/glui/glui_control.o ./include/glui/glui_edittext.o 
./include/glui/glui_filebrowser.o ./include/glui/glui_list.o ./include
/glui/glui_listbox.o ./include/glui/glui_mouse_iaction.o ./include/glui/glui_node.o 
./include/glui/glui_panel.o ./include/glui/glui_radio.o ./include/glui/glui_rollout.o 
./include/glui/glui_rotation.o ./include/glui/glui_scrollbar.o ./include
/glui/glui_separator.o ./include/glui/glui_spinner.o ./include/glui/glui_statictext.o 
./include/glui/glui_string.o ./include/glui/glui_textbox.o ./include
/glui/glui_translation.o ./include/glui/glui_tree.o ./include/glui/glui_treepanel.o 
./include/glui/glui_window.o ./include/glui/quaternion.o  ./include/freeglut
/freeglut_callbacks.o ./include/freeglut/freeglut_cursor.o ./include/freeglut
/freeglut_display.o ./include/freeglut/freeglut_ext.o ./include/freeglut
/freeglut_font.o ./include/freeglut/freeglut_font_data.o ./include/freeglut
/freeglut_gamemode.o ./include/freeglut/freeglut_geometry.o ./include/freeglut
/freeglut_glutfont_definitions.o ./include/freeglut/freeglut_init.o ./include/freeglut
/freeglut_input_devices.o ./include/freeglut/freeglut_joystick.o ./include/freeglut
/freeglut_main.o ./include/freeglut/freeglut_menu.o ./include/freeglut/freeglut_misc.o 
./include/freeglut/freeglut_overlay.o ./include/freeglut/freeglut_spaceball.o ./include
/freeglut/freeglut_state.o ./include/freeglut/freeglut_stroke_mono_roman.o ./include
/freeglut/freeglut_stroke_roman.o ./include/freeglut/freeglut_structure.o ./include
/freeglut/freeglut_teapot.o ./include/freeglut/freeglut_videoresize.o ./include
/freeglut/freeglut_window.o  ./include/Box2D/Rope/b2Rope.o  ./include/Box2D/Dynamics
/Joints/b2DistanceJoint.o ./include/Box2D/Dynamics/Joints/b2FrictionJoint.o ./include
/Box2D/Dynamics/Joints/b2GearJoint.o ./include/Box2D/Dynamics/Joints/b2Joint.o 
./include/Box2D/Dynamics/Joints/b2MouseJoint.o ./include/Box2D/Dynamics/Joints
/b2PrismaticJoint.o ./include/Box2D/Dynamics/Joints/b2PulleyJoint.o ./include/Box2D
/Dynamics/Joints/b2RevoluteJoint.o ./include/Box2D/Dynamics/Joints/b2RopeJoint.o 
./include/Box2D/Dynamics/Joints/b2WeldJoint.o ./include/Box2D/Dynamics/Joints
/b2WheelJoint.o  ./include/Box2D/Dynamics/Contacts/b2ChainAndCircleContact.o ./include
/Box2D/Dynamics/Contacts/b2ChainAndPolygonContact.o ./include/Box2D/Dynamics/Contacts
/b2CircleContact.o ./include/Box2D/Dynamics/Contacts/b2Contact.o ./include/Box2D
/Dynamics/Contacts/b2ContactSolver.o ./include/Box2D/Dynamics/Contacts
/b2EdgeAndCircleContact.o ./include/Box2D/Dynamics/Contacts/b2EdgeAndPolygonContact.o 
./include/Box2D/Dynamics/Contacts/b2PolygonAndCircleContact.o ./include/Box2D/Dynamics
/Contacts/b2PolygonContact.o  ./include/Box2D/Dynamics/b2Body.o ./include/Box2D
/Dynamics/b2ContactManager.o ./include/Box2D/Dynamics/b2Fixture.o ./include/Box2D
/Dynamics/b2Island.o ./include/Box2D/Dynamics/b2World.o ./include/Box2D/Dynamics
/b2WorldCallbacks.o  ./include/Box2D/Common/b2BlockAllocator.o ./include/Box2D/Common
/b2Draw.o ./include/Box2D/Common/b2Math.o ./include/Box2D/Common/b2Settings.o ./include
/Box2D/Common/b2StackAllocator.o ./include/Box2D/Common/b2Timer.o  ./include/Box2D
/Collision/Shapes/b2ChainShape.o ./include/Box2D/Collision/Shapes/b2CircleShape.o 
./include/Box2D/Collision/Shapes/b2EdgeShape.o ./include/Box2D/Collision/Shapes
/b2PolygonShape.o  ./include/Box2D/Collision/b2BroadPhase.o ./include/Box2D/Collision
/b2CollideCircle.o ./include/Box2D/Collision/b2CollideEdge.o ./include/Box2D/Collision
/b2CollidePolygon.o ./include/Box2D/Collision/b2Collision.o ./include/Box2D/Collision
/b2Distance.o ./include/Box2D/Collision/b2DynamicTree.o ./include/Box2D/Collision
/b2TimeOfImpact.o  ./Tests/TestEntries.o  ./Framework/Main.o ./Framework/Render.o 
./Framework/Test.o  ./Box2dInventMain.o   -lBox2D -lfreeglut -lglui -lglu32 -lopengl32
./include/freeglut/freeglut_display.o:freeglut_display.c:(.text+0xa3): undefined 
reference to `SwapBuffers@4'
./include/freeglut/freeglut_init.o:freeglut_init.c:(.text+0x212): undefined reference 
to `timeEndPeriod@4'
./include/freeglut/freeglut_init.o:freeglut_init.c:(.text+0x437): undefined reference 
to `GetDeviceCaps@8'
./include/freeglut/freeglut_init.o:freeglut_init.c:(.text+0x44f): undefined reference 
to `GetDeviceCaps@8'
./include/freeglut/freeglut_init.o:freeglut_init.c:(.text+0x472): undefined reference 
to `timeBeginPeriod@4'
 ./include/freeglut/freeglut_joystick.o:freeglut_joystick.c:(.text+0x222): undefined 
reference to `joyGetDevCapsA@12'
./include/freeglut/freeglut_joystick.o:freeglut_joystick.c:(.text+0x78a): undefined 
reference to `joyGetPosEx@8'
./include/freeglut/freeglut_main.o:freeglut_main.c:(.text+0xcf): undefined reference 
to `timeGetTime@0'
./include/freeglut/freeglut_main.o:freeglut_main.c:(.text+0x127): undefined reference 
to `timeGetTime@0'
./include/freeglut/freeglut_main.o:freeglut_main.c:(.text+0x2d7): undefined reference 
to `timeGetTime@0'
./include/freeglut/freeglut_main.o:freeglut_main.c:(.text+0x4ec): undefined reference 
to `timeGetTime@0'
./include/freeglut/freeglut_main.o:freeglut_main.c:(.text+0x11c): undefined reference 
to `timeGetTime@0'
./include/freeglut/freeglut_state.o:freeglut_state.c:(.text+0x690): undefined 
reference to `GetPixelFormat@4'
./include/freeglut/freeglut_window.o:freeglut_window.c:(.text+0x303): undefined 
reference to `GetDeviceCaps@8'
./include/freeglut/freeglut_window.o:freeglut_window.c:(.text+0x31b): undefined 
reference to `ChoosePixelFormat@8'
./include/freeglut/freeglut_window.o:freeglut_window.c:(.text+0x432): undefined 
reference to `SetPixelFormat@12'
./include/freeglut/freeglut_window.o:freeglut_window.c:(.text+0x6b6): undefined 
reference to `SetPixelFormat@12'
collect2: ld returned 1 exit status
make: *** [PhysInvent.exe] Error 1

**** Build Finished ****

无论如何,我的库路径是相对的(../PhysInvent/libs),我引用的库列表按以下顺序排列:

Box2D (from libBox2D.a)
freeglut (from freeglut.dll which uses import library libfreeglut.a)
glui (from libglui.a)
glu32 (from the Windows system libs)
opengl32 (from the Windows system libs)

在我上面链接的另一个问题中,Pwngulator声明“AFAIK,没有办法使用MinGW编译Testbed(你必须使用Visual Studio,我相信)”这对我来说很奇怪,因为源代码都存在;如果你有源代码,你不应该在任何地方构建它吗?

有没有人使用MinGW在eclipse中成功构建了Box2D测试平台?有人可以提供对上面链接器错误的深入了解吗?

感谢, CCJ

0 个答案:

没有答案