Wierd Problems [FIXED]

Ok so I have a class which controls everything. By that I mean it has functions to create bodies, or joints. Anyway this is like the main part of the code, but I only use it in the main function where I create all my bodies. Now it works perfectly fine when the declaration is in the main function, but when I try to make it global, It comes up with this error:

Quote:
1>Box2DObjects.obj : error LNK2001: unresolved external symbol "class b2World * world" (?world@@3PAVb2World@@A)
1>InitWorld.obj : error LNK2001: unresolved external symbol "class b2World * world" (?world@@3PAVb2World@@A)
1>C:\Documents and Settings\Administrator\Desktop\Projects\Box2DKcaz\Debug\Box2DKcaz.exe : fatal error LNK1120: 1 unresolved externals


Extra info:

I have a few files:
1 is the main function (Main.cpp)
1 is a file with all the GLUT callback functions (InitWorld.cpp)
1 is a file which creates all the objects and is put in the main function. (Box2DObjects.cpp)
2 are my factory class (BodyFactory.cpp/.h)

Here is the file I am having trouble with, Box2DObjects.cpp:

Code:
#include "../Include/Box2D.h"
#include "Framework/DebugDraw.h"
#include "Classes/BodyFactory.h"

extern b2World* world;
DebugDraw m_debugDraw;
b2PrismaticJoint* pj;
b2Body* bod;
BodyFactory factory;

void initWorld() {
   
   b2AABB worldAABB;
   worldAABB.lowerBound.Set(-100.0f, -100.0f);
   worldAABB.upperBound.Set(100.0f, 100.0f);
   b2Vec2 gravity(0.0f, -10.0f);
   bool doSleep = true;
   world = new b2World(worldAABB, gravity, doSleep);
   
   world->SetDebugDraw(&m_debugDraw);
   uint32 flags = 0;
   flags += 1* b2DebugDraw::e_shapeBit;
   flags += 1* b2DebugDraw::e_jointBit;   
   m_debugDraw.SetFlags(flags);
}

void gateOpen() {
   
   pj->SetMotorSpeed(-5.0);
}

void gateClose() {
   
   pj->SetMotorSpeed(5.0);
}

void initBox2D() {
   initWorld();

   factory.SetWorld(world);
   
   factory.DrawStaticRect(0.0f, -300.0f, 3000.0f, 600.0f); //body[0];
   
   factory.DrawDynamicRect(0.0f, 100.0f, 50.0f, 200.0f); //body[1];
   factory.DrawDynamicCircle(250.0f, 200.0f, 50.0f); //body[2];
   bod = factory.DrawDynamicCircle(-250.0f, 200.0f, 50.0f); //body[3]
   
   factory.DrawStaticRect(250.0f, 200.0f, 5.0f, 5.0f); //4
   factory.DrawStaticRect(0.0f, 200.0f, 5.0f, 5.0f); //5
   
   factory.CreateRevoluteJoint(2, 4, factory.body[2]->GetWorldCenter(), 0.0, 0.0, 0.0, 0.0);
   pj = factory.CreatePrismaticJoint(1, 5, factory.body[5]->GetWorldCenter(), -200.0, 100.0, 10000.0, 0.0, b2Vec2(0.0f, 1.0f));
}


Why doesn't it work if body factory is global?
Ahh sry sry sry, Just a problem from before, that I didn't rebuild until I edited that other file again, sorry, I fixed it,
Kcaz

Original thread: https://box2d.org/forum/viewtopic.php?t=2989