error LNK2001: unresolved external symbol
Hi, I was wondering if someone could help me with an unresolved external symbol
when linking my class object, plus any insights or comments on my class design is
also appreciated, thanks a lot in advance.
The class and corresponding errors are found below:
/////////////
//HEADER FILE
/////////////
//Includes
#include <dmusicc.h>
#include <dmusici.h>
class DAudioStd
{
public:
/*=================
= Con/Destructors =
=================*/
DAudioStd() {}
~DAudioStd() {}
/*==================
= Member Functions =
==================*/
bool Initialize();
//bool SetDirectory();
bool LoadAudio(WCHAR *pfilename);
bool Play(DWORD Flags = 0, __int64 StartTime = 0);
void Shutdown();
protected:
/*===========
= Variables =
===========*/
IDirectMusicPerformance8 *pAudioPerformance;
IDirectMusicLoader8 *pAudioLoader;
IDirectMusicSegment8 *pAudioSegment;
private:
};
/////////////
//SOURCE FILE
/////////////
//Includes
#include "DAudioStdCLib.h"
/*********************************************************************
DAudioStd::Initialize()
Initialize and/or create the COM library, music performance and the
loader
*********************************************************************/
bool DAudioStd::Initialize()
{
//Initialize the COM library
CoInitialize(NULL);
//Create the music performance COM
if (FAILED(CoCreateInstance(
CLSID_DirectMusicPerformance, //Class ID
NULL,
CLSCTX_INPROC,
IID_IDirectMusicPerformance8, //Interface ID
(void **)&pAudioPerformance))) //*Performance
{
return false;
}
//Initialize the music performance
if (FAILED(pAudioPerformance->InitAudio(
NULL, //Direct music
interface
NULL, //Direct sound
interface
NULL, //window handle
//default audiopath
DMUS_APATH_SHARED_STEREOPLUSREVERB,
64, //No. of channels
//Synthesizer features
DMUS_AUDIOF_ALL,
NULL))) //Default audio
parameters
{
return false;
}
//Create the music loader COM
if (FAILED(CoCreateInstance(
CLSID_DirectMusicLoader, //Class ID
NULL,
CLSCTX_INPROC,
IID_IDirectMusicLoader8, //Interface ID
(void **)&pAudioLoader))) //*Loader
{
return false;
}
//Return true on successful initialization
return true;
}
/*********************************************************************
DAudioStd::LoadAudio()
Loads an audio file on to a segment and download the band for playing
DAudioStd::LoadMusic() only accepts midi and wave file formats
*********************************************************************/
bool DAudioStd::LoadAudio(WCHAR *pfilename)
{
//Load the music on to the segment
if (FAILED(pAudioLoader->LoadObjectFromFile(
CLSID_DirectMusicSegment, IID_IDirectMusicSegment8,
pfilename, (void **)&pAudioSegment)))
{
//Failed to load
//It could be that the file is not present or
//that the format is not of type midi or wave
return false;
}
else
{
//Download the band
if (FAILED(pAudioSegment->Download(pAudioPerformance)))
{
return false;
}
else
{
return true;
}
}
}
/*********************************************************************
DAudioStd:lay()
Play audio
*********************************************************************/
bool DAudioStd:lay(DWORD Flags, __int64 StartTime)
{
return (!FAILED(pAudioPerformance->PlaySegmentEx(pAudioSegment,
NULL, NULL, Flags, StartTime, NULL, NULL, NULL)));
}
/*********************************************************************
DAudioStd::Shutdown()
Perform clean ups
*********************************************************************/
void DAudioStd::Shutdown()
{
//Unload the audio segment
pAudioSegment->Unload(pAudioPerformance);
//Close down audio performance
pAudioPerformance->CloseDown();
//Release all COM objects
pAudioSegment->Release();
pAudioLoader->Release();
pAudioPerformance->Release();
//Uninitialize the COM library
CoUninitialize();
}
////////
//ERRORS
////////
DAudioStdCLib.obj : error LNK2001: unresolved external symbol _CLSID_DirectMusicLoader
DAudioStdCLib.obj : error LNK2001: unresolved external symbol _IID_IDirectMusicLoader8
DAudioStdCLib.obj : error LNK2001: unresolved external symbol _CLSID_DirectMusicPerformance
DAudioStdCLib.obj : error LNK2001: unresolved external symbol _IID_IDirectMusicPerformance8
DAudioStdCLib.obj : error LNK2001: unresolved external symbol _CLSID_DirectMusicSegment
DAudioStdCLib.obj : error LNK2001: unresolved external symbol _IID_IDirectMusicSegment8
Debug/WinOGL.exe : fatal error LNK1120: 6 unresolved externals
As the error message states, you are not linking to one of the directories. Check out the SDK documentation and see if you missed any libraries.
You''re probobly not linking dxguid.lib. In VisualC++, go to Project->Settings->Link tab and in the Object/Library modules entry put dxguid.lib.
---
Brent Gunning | My Site | Article Thoughts: "On Batching"
---
Brent Gunning | My Site | Article Thoughts: "On Batching"
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement