Go Back   Computer Forums > General Computing > Programming
Click Here to Login
Join Computer forums Today


Reply
 
Thread Tools Search this Thread Display Modes
 
Old 11-15-2006, 07:14 PM   #1
In Runtime
 
hextcomm's Avatar
 
Join Date: Aug 2005
Posts: 237
Send a message via ICQ to hextcomm Send a message via AIM to hextcomm Send a message via MSN to hextcomm
Default Dev C++ code problem...

Hello,

Does anyone know why this code won't work in Dev C++?

/*================================================= ==============================================
PlayStream Example
Copyright (c), Firelight Technologies Pty, Ltd 2004-2005.
This example shows how to simply play a stream, such as an mp3 or wav.
The stream behaviour is achieved by specifying FMOD_CREATESTREAM in the call to
System::createSound.
This makes FMOD decode the file in realtime as it plays, instead of loading it all at once.
This uses far less memory, in exchange for a small runtime cpu hit.
================================================== =============================================*/
#include "../../api/inc/fmod.hpp"
#include "../../api/inc/fmod_errors.h"
#include <windows.h>
#include <stdio.h>
#include <conio.h>

void ERRCHECK(FMOD_RESULT result)
{
if (result != FMOD_OK)
{
printf("FMOD error! (%d) %s\n", result, FMOD_ErrorString(result));
exit(-1);
}
}

int main(int argc, char *argv[])
{
FMOD::System *system;
FMOD::Sound *sound;
FMOD::Channel *channel = 0;
FMOD_RESULT result;
int key;
unsigned int version;
/*
Create a System object and initialize.
*/
result = FMOD::System_Create(&system);
ERRCHECK(result);
result = system->getVersion(&version);
ERRCHECK(result);
if (version < FMOD_VERSION)
{
printf("Error! You are using an old version of FMOD %08x. This program requires %08x\n", version, FMOD_VERSION);
return 0;
}
result = system->init(1, FMOD_INIT_NORMAL, 0);
ERRCHECK(result);
result = system->createStream("../media/wave.mp3", FMOD_HARDWARE | FMOD_LOOP_NORMAL | FMOD_2D, 0, &sound);
ERRCHECK(result);
printf("========================================== ==========================\n");
printf("PlayStream Example. Copyright (c) Firelight Technologies 2004-2005.\n");
printf("========================================== ==========================\n");
printf("\n");
printf("Press space to pause, Esc to quit\n");
printf("\n");
/*
Play the sound.
*/
result = system->playSound(FMOD_CHANNEL_FREE, sound, false, &channel);
ERRCHECK(result);
/*
Main loop.
*/
do
{
if (kbhit())
{
key = getch();
switch (key)
{
case ' ' :
{
bool paused;
channel->getPaused(&paused);
channel->setPaused(!paused);
break;
}
}
}
system->update();
if (channel)
{
unsigned int ms;
unsigned int lenms;
bool playing;
bool paused;
channel->isPlaying(&playing);
if ((result != FMOD_OK) && (result != FMOD_ERR_INVALID_HANDLE))
{
ERRCHECK(result);
}
result = channel->getPaused(&paused);
if ((result != FMOD_OK) && (result != FMOD_ERR_INVALID_HANDLE))
{
ERRCHECK(result);
}
result = channel->getPosition(&ms, FMOD_TIMEUNIT_MS);
if ((result != FMOD_OK) && (result != FMOD_ERR_INVALID_HANDLE))
{
ERRCHECK(result);
}
result = sound->getLength(&lenms, FMOD_TIMEUNIT_MS);
if ((result != FMOD_OK) && (result != FMOD_ERR_INVALID_HANDLE))
{
ERRCHECK(result);
}
printf("Time %02d:%02d:%02d/%02d:%02d:%02d : %s\r", ms / 1000 / 60, ms / 1000 % 60, ms / 10 % 100, lenms / 1000 / 60, lenms / 1000 % 60, lenms / 10 % 100, paused ? "Paused " : playing ? "Playing" : "Stopped");
}
Sleep(10);
} while (key != 27);
printf("\n");
/*
Shut down
*/
result = sound->release();
ERRCHECK(result);
result = system->close();
ERRCHECK(result);
result = system->release();
ERRCHECK(result);
return 0;
}


Here are some of the errors:

[Linker error] undefined reference to `FMOD_System_Create@4'

C:\DOCUME~1\Nicholas\LOCALS~1\Temp\ccq2baaa.o(.tex t$_ZN4FMOD13System_CreateEPPNS_6SystemE[FMOD::System_Create(FMOD::System**)]+0xd) In function `Z16FMOD_ErrorString11FMOD_RESULT':

[Linker error] undefined reference to `_ZN4FMOD6System7releaseEv@4'

[Linker error] undefined reference to `_ZN4FMOD6System5closeEv@4'
__________________
Nicholas.

http://www.kompulsa.com

http://www.kompulsa.com/kae/

http://www.kompulsa.com/it/
hextcomm is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off



All times are GMT -5. The time now is 07:56 AM.


Powered by vBulletin® Version 3.8.8 Beta 4
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Search Engine Friendly URLs by vBSEO 3.6.0