读书人

box2d有关问题怎么在自己的c++工程中

发布时间: 2013-06-25 23:45:41 作者: rapoo

box2d问题,如何在自己的c++工程中使用box2d
在box2d官网下载的源码,编译运行没有问题 ,但是在自己的工程中调用box2d.lib 等库的时候老是有错误。



我用的是vs2005

头文件:

属性-》配置属性-》c/c++-》常规-》附加包含目录

lib库:



属性-》配置属性-》连接器-》常规-》附加库目录



属性-》配置属性-》连接器-》输入-》附加依赖项



D:\Box2D_sd\Build\Box2D\debug\Box2D.lib
D:\Box2D_sd\Build\freeglut\debug\freeglut_static.lib
D:\Box2D_sd\Build\glui\Debug\glui.lib



求帮忙:如何在自己的项目中使用box2d的lib库?





错误如下:


error LNK2019: 无法解析的外部符号 "public: void __thiscall b2World::Step(float,int,int)" (?Step@b2World@@QAEXMHH@Z),该符号在函数 _main 中被引用
1>HelloWorld.obj : error LNK2019: 无法解析的外部符号 "public: class b2Fixture * __thiscall b2Body::CreateFixture(struct b2FixtureDef const *)" (?CreateFixture@b2Body@@QAEPAVb2Fixture@@PBUb2FixtureDef@@@Z),该符号在函数 _main 中被引用
1>HelloWorld.obj : error LNK2019: 无法解析的外部符号 "public: class b2Fixture * __thiscall b2Body::CreateFixture(class b2Shape const *,float)" (?CreateFixture@b2Body@@QAEPAVb2Fixture@@PBVb2Shape@@M@Z),该符号在函数 _main 中被引用
1>HelloWorld.obj : error LNK2019: 无法解析的外部符号 "public: void __thiscall b2PolygonShape::SetAsBox(float,float)" (?SetAsBox@b2PolygonShape@@QAEXMM@Z),该符号在函数 _main 中被引用
1>HelloWorld.obj : error LNK2019: 无法解析的外部符号 "public: class b2Body * __thiscall b2World::CreateBody(struct b2BodyDef const *)" (?CreateBody@b2World@@QAEPAVb2Body@@PBUb2BodyDef@@@Z),该符号在函数 _main 中被引用
1>HelloWorld.obj : error LNK2019: 无法解析的外部符号 "public: __thiscall b2World::b2World(struct b2Vec2 const &)" (??0b2World@@QAE@ABUb2Vec2@@@Z),该符号在函数 _main 中被引用 box2d C++ 库
[解决办法]
代码里面有写:
#pragma comment(lib,"xxx.lib") 吗

读书人网 >C++

热点推荐