Well I now have several linking errors *sigh*.
I just copied the code in irrbullet helloworld.
Here is the errors:
Code: Select all
1>------ Build started: Project: Bullet, Configuration: Debug Win32 ------
1>Compiling...
1>helloworldexample.cpp
1>c:\users\Andrew\documents\visual studio 2008\projects\bullet\bullet\helloworldexample.cpp(40) : warning C4305: 'argument' : truncation from 'double' to 'irr::f32'
1>c:\users\Andrew\documents\visual studio 2008\projects\bullet\bullet\helloworldexample.cpp(40) : warning C4305: 'argument' : truncation from 'double' to 'irr::f32'
1>c:\users\Andrew\documents\visual studio 2008\projects\bullet\bullet\helloworldexample.cpp(40) : warning C4305: 'argument' : truncation from 'double' to 'irr::f32'
1>c:\users\Andrew\documents\visual studio 2008\projects\bullet\bullet\helloworldexample.cpp(40) : warning C4305: 'argument' : truncation from 'double' to 'irr::f32'
1>c:\users\Andrew\documents\visual studio 2008\projects\bullet\bullet\helloworldexample.cpp(164) : warning C4244: 'argument' : conversion from 'irr::u32' to 'irr::f32', possible loss of data
1>c:\users\Andrew\documents\visual studio 2008\projects\bullet\bullet\helloworldexample.cpp(164) : warning C4244: 'argument' : conversion from 'irr::u32' to 'irr::f32', possible loss of data
1>main.cpp
1>Generating Code...
1>Linking...
1>LINK : warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other libs; use /NODEFAULTLIB:library
1>helloworldexample.obj : error LNK2019: unresolved external symbol "public: __thiscall CExampleFramework::CExampleFramework(void)" (??0CExampleFramework@@QAE@XZ) referenced in function "public: __thiscall CHelloWorldExample::CHelloWorldExample(void)" (??0CHelloWorldExample@@QAE@XZ)
1>helloworldexample.obj : error LNK2019: unresolved external symbol "public: class IRigidBody * __thiscall CExampleFramework::shootSphere(class irr::core::vector3d<float> const &,float)const " (?shootSphere@CExampleFramework@@QBEQAVIRigidBody@@ABV?$vector3d@M@core@irr@@M@Z) referenced in function "public: virtual bool __thiscall CHelloWorldExample::OnEvent(struct irr::SEvent const &)" (?OnEvent@CHelloWorldExample@@UAE_NABUSEvent@irr@@@Z)
1>helloworldexample.obj : error LNK2019: unresolved external symbol "public: class IRigidBody * __thiscall CExampleFramework::shootCube(class irr::core::vector3d<float> const &,float,class irr::core::string<char,class irr::core::irrAllocator<char> >)const " (?shootCube@CExampleFramework@@QBEQAVIRigidBody@@ABV?$vector3d@M@core@irr@@MV?$string@DV?$irrAllocator@D@core@irr@@@45@@Z) referenced in function "public: virtual bool __thiscall CHelloWorldExample::OnEvent(struct irr::SEvent const &)" (?OnEvent@CHelloWorldExample@@UAE_NABUSEvent@irr@@@Z)
1>helloworldexample.obj : error LNK2019: unresolved external symbol "public: class IRigidBody * __thiscall CExampleFramework::addCube(class irr::core::vector3d<float> const &,class irr::core::vector3d<float> const &,float,class irr::core::string<char,class irr::core::irrAllocator<char> >)const " (?addCube@CExampleFramework@@QBEQAVIRigidBody@@ABV?$vector3d@M@core@irr@@0MV?$string@DV?$irrAllocator@D@core@irr@@@45@@Z) referenced in function "public: void __thiscall CHelloWorldExample::createBoxes(void)" (?createBoxes@CHelloWorldExample@@QAEXXZ)
1>helloworldexample.obj : error LNK2019: unresolved external symbol "public: virtual __thiscall CExampleFramework::~CExampleFramework(void)" (??1CExampleFramework@@UAE@XZ) referenced in function "public: virtual __thiscall CHelloWorldExample::~CHelloWorldExample(void)" (??1CHelloWorldExample@@UAE@XZ)
1>C:\Users\Andrew\Documents\Visual Studio 2008\Projects\Bullet\Debug\Bullet.exe : fatal error LNK1120: 5 unresolved externals
1>Build log was saved at "file://c:\Users\Andrew\Documents\Visual Studio 2008\Projects\Bullet\Bullet\Debug\BuildLog.htm"
1>Bullet - 6 error(s), 7 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
here are the code in the files i copied over:
main.cpp
Code: Select all
#include <irrlicht.h>
#include "helloworldexample.h"
int main()
{
CHelloWorldExample example;
example.runExample();
return 0;
}
helloworldexample.h
Code: Select all
// This example is part of irrBullet by Josiah Hartzell (fighterstw@hotmail.com or josiah.hartzell@gmail.com)
#ifndef __HELLO_WORLD_EXAMPLE_H_INCLUDED__
#define __HELLO_WORLD_EXAMPLE_H_INCLUDED__
#include "exampleframework.h"
#include <irrString.h>
#include <irrTypes.h>
class IRigidBody;
class CHelloWorldExample : public CExampleFramework
{
public:
CHelloWorldExample();
virtual ~CHelloWorldExample();
virtual void runExample();
virtual bool OnEvent(const irr::SEvent& event);
void createBoxes();
void createGround();
private:
irr::u32 rows;
irr::u32 columns;
};
#endif // __HELLO_WORLD_EXAMPLE_H_INCLUDED__
helloworldexample.cpp
Code: Select all
// This example is part of irrBullet by Josiah Hartzell (fighterstw@hotmail.com or josiah.hartzell@gmail.com)
#include <irrlicht.h>
#include <irrBullet.h>
#include "helloworldexample.h"
using namespace irr;
using namespace core;
using namespace video;
using namespace scene;
using namespace gui;
using namespace io;
using namespace std;
CHelloWorldExample::CHelloWorldExample()
{
}
bool CHelloWorldExample::OnEvent(const SEvent& event)
{
if (!device)
return false;
switch(event.EventType)
{
case EET_MOUSE_INPUT_EVENT:
{
if(event.MouseInput.Event==EMIE_LMOUSE_PRESSED_DOWN)
{
shootCube(vector3df(2,2,2), 1);
return true;
}
else
if(event.MouseInput.Event==EMIE_RMOUSE_PRESSED_DOWN)
{
shootSphere(vector3df(0.2,0.2,0.2), 0.2);
return true;
}
}
break;
case EET_KEY_INPUT_EVENT:
{
if(event.KeyInput.Key == KEY_KEY_P && event.KeyInput.PressedDown == false)
{
world->pauseSimulation(!world->simulationPaused());
return true;
}
else
if(event.KeyInput.Key == KEY_KEY_R && event.KeyInput.PressedDown == false)
{
while(world->getNumCollisionObjects() > 0)
{
world->removeCollisionObject(world->getCollisionObjectByIndex(0));
}
createGround();
createBoxes();
return true;
}
}
break;
default:
break;
}
return false;
}
void CHelloWorldExample::runExample()
{
debugDraw = true;
drawProperties = true;
drawWireFrame = false;
rows = 10;
columns = 10;
device =
createDevice( video::EDT_OPENGL, dimension2d<u32>(640, 480), 16,
false, false, false, this);
printf("Number of stack rows: ");
cin >> rows;
printf("\nNumber of stack columns: ");
cin >> columns;
device->setWindowCaption(L"irrBullet Hello World Example - Josiah Hartzell");
device->getFileSystem()->addFolderFileArchive("../../media/");
device->getSceneManager()->addLightSceneNode(0, vector3df(20, 40, -50), SColorf(1.0f, 1.0f, 1.0f), 4000.0f);
////////////////////////////
// Create irrBullet World //
////////////////////////////
world = createIrrBulletWorld(device, true, debugDraw);
world->setDebugMode(EPDM_DrawAabb |
EPDM_DrawContactPoints);
world->setGravity(vector3df(0,-10,0));
camera = device->getSceneManager()->addCameraSceneNodeFPS();
camera->setPosition(vector3df(50,15,200));
createGround();
createBoxes();
// Set our delta time and time stamp
u32 TimeStamp = device->getTimer()->getTime();
u32 DeltaTime = 0;
while(device->run())
{
device->getVideoDriver()->beginScene(true, true, SColor(255,100,101,140));
DeltaTime = device->getTimer()->getTime() - TimeStamp;
TimeStamp = device->getTimer()->getTime();
// Step the simulation with our delta time
world->stepSimulation(DeltaTime*0.001f, 120);
world->debugDrawWorld(debugDraw);
// This call will draw the technical properties of the physics simulation
// to the GUI environment.
world->debugDrawProperties(true);
device->getSceneManager()->drawAll();
device->getGUIEnvironment()->drawAll();
device->getVideoDriver()->endScene();
}
// We're done with the IrrBullet world, so we free the memory that it takes up.
if(world)
delete world;
if(device)
device->drop();
}
void CHelloWorldExample::createBoxes()
{
for(u32 j=0; j < columns; j++)
{
for(u32 i=0; i < rows; i++)
{
addCube(vector3df(3*j, 0+3*i+3, 0), vector3df(3,3,3), 3);
}
}
}
void CHelloWorldExample::createGround()
{
ISceneNode *Node = device->getSceneManager()->addCubeSceneNode(1.0);
Node->setScale(vector3df(300,3,300)); // 400, 3, 400
Node->setPosition(vector3df(20,0,10));
Node->setMaterialFlag(video::EMF_LIGHTING, true);
Node->setMaterialFlag(video::EMF_NORMALIZE_NORMALS, true);
Node->setMaterialTexture(0, device->getVideoDriver()->getTexture("rockwall.jpg"));
if(drawWireFrame)
Node->setMaterialFlag(EMF_WIREFRAME, true);
ICollisionShape *shape = new IBoxShape(Node, 0, false);
//shape->setMargin(0.01);
IRigidBody *body;
body = world->addRigidBody(shape);
}
CHelloWorldExample::~CHelloWorldExample()
{
}