Box2D Forums

It is currently Sat May 25, 2013 10:38 pm

All times are UTC - 8 hours [ DST ]




Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: Thu Sep 22, 2011 10:35 am 
Offline

Joined: Thu Sep 22, 2011 3:10 am
Posts: 2
Hi, this is my first post to this forum.
I'm trying to learn the box2d library making a MFC C++ project in VS 2010. Base code has been taken from Nehe OpenGL tutorials web site. I have added a header and a source file to the project namely box2DObject.h and box2DObject.cpp . And I have created a class box2DObject as shown below (first code block is the header and the other is the source file) . But when I have implement the constructor in the source file compiler gave "the unresolved external symbol error" as below: On the other hand if I implement the constructor in the header file compiler gave no error. What could be the reason ? Does anyone knows a compiler option to eliminate this error ?

1>------ Build started: Project: NeheMFC, Configuration: Debug Win32 ------
1> box2DObject.cpp
1> Generating Code...
1> Compiling...
1> Main.cpp
1> Generating Code...
1>box2DObject.obj : error LNK2019: unresolved external symbol "public: __thiscall b2World::b2World(struct b2Vec2 const &,bool)" (??0b2World@@QAE@ABUb2Vec2@@_N@Z) referenced in function "public: __thiscall box2DObject::box2DObject(void)" (??0box2DObject@@QAE@XZ)
1>.\Debug\NeheMFC.exe : fatal error LNK1120: 1 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

Code:
#include "stdafx.h"
#include <Box2D\Box2D.h>

class box2DObject
   {
   public:
      box2DObject();

      b2Vec2 gravity;
      bool doSleep;
      b2World* world;
   };


Code:
#include "stdafx.h"
#include "box2DObject.h"

box2DObject::box2DObject()
   {
      gravity.Set(0.0f,-10.0f);
      doSleep=true;
      world=new b2World(gravity,doSleep);
   }


Top
 Profile  
 
PostPosted: Thu Sep 22, 2011 4:08 pm 
Offline
Site Admin

Joined: Thu Sep 06, 2007 12:34 am
Posts: 2931
The latest version of b2World does not take a sleep bool in the constructor.


Top
 Profile  
 
PostPosted: Sun Sep 25, 2011 12:36 pm 
Offline

Joined: Thu Sep 22, 2011 3:10 am
Posts: 2
ok, I have installed the latest issue. Same problem again?


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 8 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
cron
Powered by phpBB® Forum Software © phpBB Group