Expected ')' before '*' token
So this is more of a syntax problem. I keep getting t开发者_如何转开发he error "Expected ')' before '*' token" on the line:
#include "CDocumentObserver.h"
#include "CViewPlayerDlg.h"
/*
* Class: CViewPlayer
*
*/
class CViewPlayer : public wxWindow, public CDocumentObserver
{
public:
CViewPlayer(CViewPlayerDlg *dlg); //here
in CViewPlayer.h. The .cpp constructor looks like:
#include "CViewPlayer.h"
#include "wx/prec.h"
#include "CViewPlayerDlg.h"
using namespace std;
BEGIN_EVENT_TABLE(CViewPlayer, wxWindow)
EVT_PAINT(CViewPlayer::OnPaint)
END_EVENT_TABLE()
CViewPlayer::CViewPlayer(CViewPlayerDlg *dlg) :
wxWindow(dlg, wxID_ANY, wxDefaultPosition, wxSize(dlg->GetDocument()->GetSize()), wxBORDER_SUNKEN),
CDocumentObserver(dlg->GetDocument()), mStartTime(0), mPlayTime(0), mPlaying(false)
{
SetBackgroundColour(wxColour(128, 128, 128));
SetClientSize(GetDocument()->GetSize());
}
What causes this error? I thought it was that something was wrong in the constructor of the .cpp but I have no idea.
This typically means that a class has not been declared.
Check to see that CViewPlayerDlg
is declared before you use it in the declaration of the CViewPlayer
constructor, CViewPlayer(CViewPlayerDlg* dlg)
.
A syntax error in a header file generally means that the error is in the header file, not the source (.cpp) file.
精彩评论