Irrlicht Engine logo

Tutorial: Irrlicht & Codewarrior by André Simon

Introduction

Compiling Irrlicht and Audiere examples with Metrowerks Codewarrior 8 - HOWTO

Version 1.0

4/9/2003

To all Mac Users: I am talking about the Win32 port of Codewarrior. Sorry


This HOWTO should work for other versions than CW 8.0, too.
Codewarrior is compatible with the VC++ DLLs shipped with irrlicht and audiere,
but there are some glitches to make it work.


A) Setting up a new irrlicht project

0. Copy the Visual C++ irrlicht.dll to the directory where your executable will
reside or to c:\windows_directory\system32

1. Choose New Project -> Win32 C++ Stationary
Choose "Win32 Console App"
then "App using default libraries"

2. A cpp file "hello.cpp" is created.
Replace the content by the first irrlicht tutorial's code

3. replace #include <irrlicht.h> by #include "irrlicht.h"
(btw The notation with <someheader> is only allowed for c++ standard headers)

4. In the source, set the (absolute) path to the Visual Studio irrlicht.lib file
Example:
#pragma comment(lib, "E:\\CPP\\irrlicht-0.4\\lib\\VisualStudio\\Irrlicht.lib")
As an alternative, you can add the lib file to your project with Project-> Add files

5. Go to the project settings (left button in project tab, near the run button )
Choose Target -> Access Paths
Add the irrlicht include directory
then apply

6. Compile and run

B) Setting up a new audiere project

1. Open audiere.h in the include directory
Replace all strchr function calls by by std::strchr

2. Copy the audiere.dll to the directory where your executable will
reside or to c:\windows_directory\system32

2. New Project -> Empty Project

3. Add the Audiere.lib to your project (see irrlicht step A.4)

3. Add the audiere include path to your access paths (see A.5)

6. Add a new file with the name main.cpp

7. Paste this to main.cpp:

code:

#include <iostream> 
#include "audiere.h" 
using namespace audiere; 

int main(char ** args)
{ 
    AudioDevicePtr device(OpenDevice()); 
    if (!device)  
        std::cerr <<"BAD DEVICE"<<std::endl;
    
    OutputStreamPtr sound(OpenSound(device, 
        "path\\to\\test.wav", false)); 

    if (!sound)
        std::cerr <<"BAD SOUND"<<std::endl;
    
    OutputStreamPtr stream(OpenSound(device,
        "path\\to\\ogg\\or\\mp3\\file.ogg", true)); 

    if (!stream)
        std::cerr <<"BAD STREAM"<<std::endl;
    
    stream->play(); 
    sound->play(); 
    char wait; 
    std::cin >> wait; // dont exit too fast, 
// we want to hear some sound
return 0; }


8. Compile and run

You may ask questions if this HOWTO does not work for you.
Please do not ask me something regarding Irrlicht or audiere API.

André Simon
andre.simon1@gmx.de
http://www.andre-simon.de/

 

 

 


Valid XHTML 1.0! Valid CSS!


Irrlicht Engine and Irrlicht Engine webpage © 2003-2005 by Nikolaus Gebhardt