Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Calling functions from other classes

Status
Not open for further replies.

Jaredino

Technical User
Jan 31, 2006
17
GB
Hi I'm creating a project in MFC for the first time. In 'normal' C++ to call a function from class CWavHeader in the class CWavFile I would simply do this

#include "WavHeader.h"

class WavFile
{
....
....

CWavHeader header
}

Then in cpp file:

header.getSampleRate();

-----------------------------

but it won't let me and gives the following error:
error C2501: 'CWavHeader' : missing storage-class or type specifiers

I'm presuming that you can't do this in an MFC environment so how do I do it??

Thanks
 
It should work the same way.
Where are you getting that error?
 
It just comes up with these 3 errors in the Wavfile header:

wavfile.h(37) : error C2146: syntax error : missing ';' before identifier 'header'
wavfile.h(37) : error C2501: 'CWavHeader' : missing storage-class or type specifiers
wavfile.h(37) : error C2501: 'header' : missing storage-class or type specifiers

I must be making some kind of school boy error here but it's not having it?
 
It's telling you that CWavHeader isn't declared anywhere.
Does "WavHeader.h" declare CWavHeader in it?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top