Jump to content
  • Advertisement
Sign in to follow this  


This topic is 3535 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am trying to use a 2d physics library(Box2d) however when I try to compile some of the sample code I get this error message. 1>LINK : fatal error LNK1104: cannot open file 'glui.lib' I suppose it's asking me for a library, I think I've heard the term before, does anyone know what is it and/or where can I get it?
#include "Box2D.h"
#include <cstdio>
// This is a simple example of building and running a simulation
// using Box2D. Here we create a large ground box and a small dynamic
// box.
int main(int argc, char** argv)
	// Define the size of the world. Simulation will still work
	// if bodies reach the end of the world, but it will be slower.
	b2AABB worldAABB;
	worldAABB.lowerBound.Set(-100.0f, -100.0f);
	worldAABB.upperBound.Set(100.0f, 100.0f);
	// Define the gravity vector.
	b2Vec2 gravity(0.0f, -10.0f);
	// Do we want to let bodies sleep?
	bool doSleep = true;
	// Construct a world object, which will hold and simulate the rigid bodies.
	b2World world(worldAABB, gravity, doSleep);
	// Define the ground body.
	b2BodyDef groundBodyDef;
	groundBodyDef.position.Set(0.0f, -10.0f);
	// Call the body factory which allocates memory for the ground body
	// from a pool and creates the ground box shape (also from a pool).
	// The body is also added to the world.
	b2Body* groundBody = world.CreateBody(&groundBodyDef);
	// Define the ground box shape.
	b2PolygonDef groundShapeDef;
	// The extents are the half-widths of the box.
	groundShapeDef.SetAsBox(50.0f, 10.0f);
	// Add the ground shape to the ground body.
	// Define the dynamic body. We set its position and call the body factory.
	b2BodyDef bodyDef;
	bodyDef.position.Set(0.0f, 4.0f);
	b2Body* body = world.CreateBody(&bodyDef);
	// Define another box shape for our dynamic body.
	b2PolygonDef shapeDef;
	shapeDef.SetAsBox(1.0f, 1.0f);
	// Set the box density to be non-zero, so it will be dynamic.
	shapeDef.density = 1.0f;
	// Override the default friction.
	shapeDef.friction = 0.3f;
	// Add the shape to the body.
	// Now tell the dynamic body to compute it's mass properties base
	// on its shape.
	// Prepare for simulation. Typically we use a time step of 1/60 of a
	// second (60Hz) and 10 iterations. This provides a high quality simulation
	// in most game scenarios.
	float32 timeStep = 1.0f / 60.0f;
	int32 velocityIterations = 8;
	int32 positionIterations = 1;
	// This is our little game loop.
	for (int32 i = 0; i < 60; ++i)
		// Instruct the world to perform a single step of simulation. It is
		// generally best to keep the time step and iterations fixed.
		world.Step(timeStep, velocityIterations);
		// Now print the position and angle of the body.
		b2Vec2 position = body->GetPosition();
		float32 angle = body->GetAngle();
		printf("%4.2f %4.2f %4.2f\n", position.x, position.y, angle);
	// When the world destructor is called, all bodies and joints are freed. This can
	// create orphaned pointers, so be careful about your world management.
	return 0;

[Edited by - Antonym on January 19, 2009 9:36:42 AM]

Share this post

Link to post
Share on other sites
what do u mean 'linked against this'?

I am following this tutorial to 'install' opengl glui/glut


Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!