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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

stupid MFC AppWizard!

Status
Not open for further replies.

javaguy1

Programmer
May 14, 2003
136
US
i am following a tutorial on MFC. it is a SDI app. when i try to compile there are 3 errors, and they are from the code the wizard generated! they are in the Doc.cpp file. here is the code

// CBugTracksDoc diagnostics

#ifdef _DEBUG
void CBugTracksDoc::AssertValid() const
{//error here
CDocument::AssertValid();
}

void CBugTracksDoc::Dump(CDumpContext& dc) const
{//error here
CDocument::Dump(dc);
}
#endif //_DEBUG

/////////////////////////////////////////////////////////////////////////////
// CBugTracksDoc commands//error here

here are the errors

C:\My Courses\Cs133u\BugTracks\BugTracksDoc.cpp(85) : error C2601: 'AssertValid' : local function definitions are illegal
C:\My Courses\Cs133u\BugTracks\BugTracksDoc.cpp(90) : error C2601: 'Dump' : local function definitions are illegal
C:\My Courses\Cs133u\BugTracks\BugTracksDoc.cpp(97) : fatal error C1004: unexpected end of file found

what's going on?
 
I would suspect the file is missing the #include "stdafx.h" statement. If this is true, I seriously doubt that the "stupid MFC AppWizard" left it out. I have use AppWizard millions of times… ok thousands of times… ok a lot of times [lol] and have never seen that happen. It was more than likely caused by a loose nut between the chair and the keyboard ;-)

-pete
 
no it is included

// BugTracksDoc.cpp : implementation of the CBugTracksDoc class
//

#include "stdafx.h"
#include "BugTracks.h"

#include "BugTracksDoc.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

i followed the directions. it is very simple program. here is link to the tutorial

 
never mind, i found it. amazing what a missing brace will do
 
Nice article!

Ok so you followed the instructions exactly for using AppWizard and when it finished running you tried to build the project and it failed?

If that is the case i would try to repeat the steps exactly. First shut down VC++. Then delete the entire folder that it generated for the project using Windows Exploder. Then start VC++ back up and repeat the steps. I would guess the problem will not repeat itself.

What version of VC are you using?

Good luck

-pete
 
ahhh.. it was a loose nut between the chair and the keyboard. [lol] That's always my first suspicion when a problem arises in my code. ;-) And 9999 times out of 10000 that it!

-pete
 
When I have experienced this error it is because there is a missing brace "}". So it appears to the compiler that another function is starting before the previous one has ended.

-Pat Kane
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top