codewarrior compilation

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
Saalen
Posts: 51
Joined: Thu Sep 04, 2003 7:49 am
Location: Germany
Contact:

codewarrior compilation

Post by Saalen »

Hi,

I am having trouble to compile Irrlicht demo code within Metrowerks Codewarrior.
I set the irrlicht include path and included the visualc++ lib file to the projekt.

Code: Select all

Error   : Undefined symbol: '__declspec(dllimport) class irr::IrrlichtDevice * irr::createDevice(enum irr::video::EDriverType, class irr::core::dimension2d<int> const &, unsigned int, bool, bool, class irr::IEventReceiver *) (__imp_?createDevice@irr@@YAPAVIrrlichtDevice@1@W1EDriverType@video@1@ABV?$dimension2d@H@core@1@I_N2PAVIEventReceiver@1@@Z)'
referenced from '_main' in main.cpp:92
main.cpp line 92
Are there any other flags that need to be set, or is a new lib file needed for Codewarrior ?

BTW compilation with bloodshed devcpp works fine, but the audiere sound lib causes problems there.
Funnily enough, audiere works in Codewarrior. So any help regarding irrlicht in cw or audier in devcpp
is appreciated.

André[/code]
niko
Site Admin
Posts: 1759
Joined: Fri Aug 22, 2003 4:44 am
Location: Vienna, Austria
Contact:

Post by niko »

Hi, it seems that codewarrior, VisualC++ and g++ have different naming conventions. So it would help to recompile the whole engine with codewarrior and use the lib it generated. I don't own a codewarrior (although I would like to :wink: ), so there is no official support for it. But it would be cool if you could try to remcompile the engine and bring it to run with codewarrior.
Saalen
Posts: 51
Joined: Thu Sep 04, 2003 7:49 am
Location: Germany
Contact:

Post by Saalen »

Ok, I'll let you know whether I succeded, and describe the way how to do it if necessary.

André
niko
Site Admin
Posts: 1759
Joined: Fri Aug 22, 2003 4:44 am
Location: Vienna, Austria
Contact:

Post by niko »

Cool, thanks!
Saalen
Posts: 51
Joined: Thu Sep 04, 2003 7:49 am
Location: Germany
Contact:

Codewarrior HOWTO

Post by Saalen »

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: Select all

#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/

----

If you want them I provide some screenshots, maybe you want to put it on your site like the devcpp howto.
niko
Site Admin
Posts: 1759
Joined: Fri Aug 22, 2003 4:44 am
Location: Vienna, Austria
Contact:

Post by niko »

Wow, that's very cool, thank you for this detailed howto. And yes, I'd really like to put it on the tutorial homepage. I'll convert it into html and upload it until tomorror and if you want you can mail me one or two (or more)screenshots.
Saalen
Posts: 51
Joined: Thu Sep 04, 2003 7:49 am
Location: Germany
Contact:

Post by Saalen »

Ok, i'll try to send it to you during the weekend.

Gräätz di 8)
Post Reply