[SOLVED] Irrbullet: Help Getting It to work in project

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
Oster200
Posts: 60
Joined: Sun May 06, 2012 6:13 pm

[SOLVED] Irrbullet: Help Getting It to work in project

Post by Oster200 »

I am using Visual Studio c++ 2008 and I read that readme.txt file but i feel like i am doing it wrong.
3.1. Add these search directories to your project:
%irrBullet%/source
%irrBullet%/source/bheaders
%irrBullet%/source/bheaders/Bullet
So do i go Tool->Options->Projects and Solutions->VC++ Directories then switch Show Directories for: Include Files?
3.2. add "#include <irrBullet.h>" to the top of your project
with the other includes.
Added that at the top
3.3. add these files to your linker (available in the libs/ folder):
libirrBullet.a, libbulletdynamics.a, libbulletsoftbody.a
libGIMPACTUtils.a (if you use GImpact),
liblinearmath.a, libbulletcollision.a

Make sure the linker files are in that order for irrBullet
or your project will not compile.
Then do I have to go Tool->Options->Projects and Solutions->VC++ Directories then switch Show Directories for: to library?
I think this is wrong because you can only select folders so you cant select them in order.

Oster200
Last edited by Oster200 on Thu Aug 16, 2012 4:57 pm, edited 1 time in total.
Oster200
Posts: 60
Joined: Sun May 06, 2012 6:13 pm

Re: Irrbullet: Help Getting It to work in project

Post by Oster200 »

I know a lot of people here use bullet...I just need to know the steps on how to install.
Do i need the bullet to be installed be for the bullet wrapper?
And where do i put the stuff in first post.
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Irrbullet: Help Getting It to work in project

Post by CuteAlien »

Just to be sure you understood that correct... the "add "#include <irrBullet.h>" to the top of your project" means to the top of your source-file, not to the top of the Include Files Directories (there you add the directory).
And you can change the order of libs after adding them by moving them up-down.
And I suppose you have to add bullet certainly if you want to use it with some wrapper.

Aside from that... you didn't tell which problem you actually have - so no one really knows what you need help with. Any errors?
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
zerochen
Posts: 273
Joined: Wed Jan 07, 2009 1:17 am
Location: Germany

Re: Irrbullet: Help Getting It to work in project

Post by zerochen »

ah now i understand what you are trying to do:D

you have to add something like those paths to the lib settings:

F:\Irrlicht\tools\irrBullet\lib\win32_visualstudio\2008
F:\Bullet\lib

then you have to add the libs explicit here:
right click on your project -> properties -> linker -> input

regards
zerochen
Oster200
Posts: 60
Joined: Sun May 06, 2012 6:13 pm

Re: Irrbullet: Help Getting It to work in project

Post by Oster200 »

then you have to add the libs explicit here:
right click on your project -> properties -> linker -> input
That are these lib right? libirrBullet.a, libbulletdynamics.a, libbulletsoftbody.a
libGIMPACTUtils.a (if you use GImpact),
liblinearmath.a, libbulletcollision.a

If so why do they have an .a after them do i out them in with out the lib infront and without the .a after so it would be like this irrBullet.lib for example?

and this is where i write it right? Image
zerochen
Posts: 273
Joined: Wed Jan 07, 2009 1:17 am
Location: Germany

Re: Irrbullet: Help Getting It to work in project

Post by zerochen »

yeah this is the right place.
.a are for linux
.lib for windows

so i think you have to change the names to *.lib and enter they in the box in the right order

thats my include order: (names may be different)
BulletMultiThreaded.lib
BulletCollision.lib
BulletDynamics.lib
BulletSoftBody.lib
LinearMath.lib
Oster200
Posts: 60
Joined: Sun May 06, 2012 6:13 pm

Re: Irrbullet: Help Getting It to work in project

Post by Oster200 »

Well this is what i got for errors
i copied the helloworld from the irrbullet project

just now:

Code: Select all

1>------ Build started: Project: Bullet, Configuration: Debug Win32 ------
1>Compiling...
1>main.cpp
1>helloworldexample.cpp
1>c:\users\Andrew\documents\visual studio 2008\projects\bullet\bullet\helloworldexample.cpp(4) : fatal error C1083: Cannot open include file: 'irrBullet.h': No such file or directory
1>Generating Code...
1>Build log was saved at "file://c:\Users\Andrew\Documents\Visual Studio 2008\Projects\Bullet\Bullet\Debug\BuildLog.htm"
1>Bullet - 1 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Last edited by Oster200 on Thu Aug 16, 2012 3:07 pm, edited 1 time in total.
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Irrbullet: Help Getting It to work in project

Post by CuteAlien »

You haven't added the directory where irrBullet.h can be found to the include directories then.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Oster200
Posts: 60
Joined: Sun May 06, 2012 6:13 pm

Re: Irrbullet: Help Getting It to work in project

Post by Oster200 »

Where would irrbullet.h be?
zerochen
Posts: 273
Joined: Wed Jan 07, 2009 1:17 am
Location: Germany

Re: Irrbullet: Help Getting It to work in project

Post by zerochen »

in your irrbullet source folder of course
like you wrote in 3.1
Oster200
Posts: 60
Joined: Sun May 06, 2012 6:13 pm

Re: Irrbullet: Help Getting It to work in project

Post by Oster200 »

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()
{
}
 
zerochen
Posts: 273
Joined: Wed Jan 07, 2009 1:17 am
Location: Germany

Re: Irrbullet: Help Getting It to work in project

Post by zerochen »

you have to add both cpp files to the project (helloworldexample.cpp and exampleframework.cpp)
Oster200
Posts: 60
Joined: Sun May 06, 2012 6:13 pm

Re: Irrbullet: Help Getting It to work in project

Post by Oster200 »

Thankyou zerochen it is working you are amazing :D

and we cant forget you, CuteAlien.
Nash94
Posts: 20
Joined: Fri Aug 31, 2012 3:21 pm

Re: Irrbullet: Help Getting It to work in project

Post by Nash94 »

did yo rename all the .a files to .lib? Im using VS10 and i get "Unable to start program irrBullet.lib The specificed file is an unrecognized or unsupported binary format" error
zerochen
Posts: 273
Joined: Wed Jan 07, 2009 1:17 am
Location: Germany

Re: [SOLVED] Irrbullet: Help Getting It to work in project

Post by zerochen »

hi,

you cant rename the files. you have to recompile bullet and then you get the .lib files (if you are on windows)

.a = linux lib files
.lib = windows lib files
Post Reply