Page 1 of 1

C++ Help

PostPosted: Mar 29, 2003 @ 4:08am
by zinger
I'm now one week into C++ and need help. I'm playing with GAPIDRAW trying to add sound. My problem is this whole class business and variable declarations. Here's the code:

CWave * m_cWave;
m_cWave = new CWave( );

DWORD m_dwSysVolume = m_cWave->getVolume( );
m_cWave->setVolume(0x71C471C4);
m_cWave->playResourceWav(hInst, IDR_WAVE, false);

This works from within WinMain. If I use m_cWave from within the GAPIDRAW functions I recieve m_cWave' : undeclared identifier. I'm sure this is basic C++ stuff that's why I posted here instead of the GAPIDRAW forum.

Please forgive my newbieness.

PostPosted: Mar 29, 2003 @ 5:11am
by Dan East
You need to include the header that defines the CWave class. Probably gapidraw.h or something like that.

Dan East

PostPosted: Mar 29, 2003 @ 6:49am
by zinger

PostPosted: Mar 29, 2003 @ 8:51am
by Dan East
You need to provide the prototype for the class in a header file, so you can include it in other source files.

This:
class CWave
{
stuff deleted
};

should go into a .h file. Include that file in any cpp that uses that class.

Dan East

PostPosted: Mar 29, 2003 @ 5:52pm
by zinger
That worked. Thanks Dan!