Click here to Skip to main content
15,909,747 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionWindow minimised or Lost focus ??? Pin
Md Saleem Navalur9-Oct-04 2:30
Md Saleem Navalur9-Oct-04 2:30 
AnswerRe: Window minimised or Lost focus ??? Pin
Ravi Bhavnani9-Oct-04 6:50
professionalRavi Bhavnani9-Oct-04 6:50 
GeneralAvoiding anti-virus warnings with scripts. Pin
Krishnan V9-Oct-04 1:57
Krishnan V9-Oct-04 1:57 
GeneralRe: Avoiding anti-virus warnings with scripts. Pin
Andrew Walker10-Oct-04 0:12
Andrew Walker10-Oct-04 0:12 
Questionmultiselection in CEdit...?? Pin
scoroop9-Oct-04 1:36
scoroop9-Oct-04 1:36 
AnswerRe: multiselection in CEdit...?? Pin
Ravi Bhavnani9-Oct-04 7:00
professionalRavi Bhavnani9-Oct-04 7:00 
GeneralCreate Custom UI controls Pin
P. Gnana Prakash9-Oct-04 0:06
P. Gnana Prakash9-Oct-04 0:06 
Questionbeginner: program corrupted somehow? Pin
7stud8-Oct-04 23:30
7stud8-Oct-04 23:30 
Hi,

I was doing one of the beginning VC++ tutorials, and I added a member variable to a class by right clicking on the class name and choosing Add Member Variable from the context menu. However, I typed in the wrong name for the variable, so I wanted to delete it. There didn't seem to be a way to delete a variable using the Class Wizard, so I navigated to the variable in the header file, and I deleted it.

However, when I tried to add the variable with the correct name (once again right clicking on the class name, and choosing Add Member Variable), a pop up box informed me the variable name could not be added. So, I added it by hand to the header file, as well as a few more variables, but when I went to build the project, I got 18 errors relating to the top of the .cpp file for the class.

Is my only option to delete the whole program and start over?

Below I included parts of the code with some comments:

errors:
------------
ompiling...
CodeProject_Dialog2.cpp
C:\Beginning C++\CodeProject_Dialog2\CodeProject_Dialog2.cpp(11) : error C2258: illegal pure syntax, must be '= 0'
C:\Beginning C++\CodeProject_Dialog2\CodeProject_Dialog2.cpp(11) : error C2252: 'THIS_FILE' : pure specifier can only be specified for functions
C:\Beginning C++\CodeProject_Dialog2\CodeProject_Dialog2.cpp(17) : error C2838: illegal qualified name in member declaration
C:\Beginning C++\CodeProject_Dialog2\CodeProject_Dialog2.cpp(17) : error C2059: syntax error : 'return'
C:\Beginning C++\CodeProject_Dialog2\CodeProject_Dialog2.cpp(17) : error C2238: unexpected token(s) preceding ';'
C:\Beginning C++\CodeProject_Dialog2\CodeProject_Dialog2.cpp(17) : error C2143: syntax error : missing ';' before '*'
C:\Beginning C++\CodeProject_Dialog2\CodeProject_Dialog2.cpp(17) : error C2501: 'GetMessageMap' : missing storage-class or type specifiers
C:\Beginning C++\CodeProject_Dialog2\CodeProject_Dialog2.cpp(17) : error C2556: 'int *__thiscall CCodeProject_Dialog2App::GetMessageMap(void) const' : overloaded function differs only by return type from 'const struct AFX_MSGMAP *__thiscall CCodePro
ject_Dialog2App::GetMessageMap(void) const'
c:\beginning c++\codeproject_dialog2\codeproject_dialog2.h(40) : see declaration of 'GetMessageMap'
C:\Beginning C++\CodeProject_Dialog2\CodeProject_Dialog2.cpp(17) : error C2373: 'GetMessageMap' : redefinition; different type modifiers
c:\beginning c++\codeproject_dialog2\codeproject_dialog2.h(40) : see declaration of 'GetMessageMap'
C:\Beginning C++\CodeProject_Dialog2\CodeProject_Dialog2.cpp(17) : error C2143: syntax error : missing ';' before 'tag::id'
C:\Beginning C++\CodeProject_Dialog2\CodeProject_Dialog2.cpp(17) : error C2734: 'AFX_MSGMAP' : const object must be initialized if not extern
C:\Beginning C++\CodeProject_Dialog2\CodeProject_Dialog2.cpp(17) : error C2371: 'AFX_MSGMAP' : redefinition; different basic types
C:\Beginning C++\CodeProject_Dialog2\CodeProject_Dialog2.cpp(17) : see declaration of 'AFX_MSGMAP'
C:\Beginning C++\CodeProject_Dialog2\CodeProject_Dialog2.cpp(17) : fatal error C1004: unexpected end of file found
CodeProject_Dialog2Dlg.cpp
C:\Beginning C++\CodeProject_Dialog2\CodeProject_Dialog2Dlg.cpp(11) : error C2258: illegal pure syntax, must be '= 0'
C:\Beginning C++\CodeProject_Dialog2\CodeProject_Dialog2Dlg.cpp(11) : error C2252: 'THIS_FILE' : pure specifier can only be specified for functions
C:\Beginning C++\CodeProject_Dialog2\CodeProject_Dialog2Dlg.cpp(41) : error C2057: expected constant expression
C:\Beginning C++\CodeProject_Dialog2\CodeProject_Dialog2Dlg.cpp(41) : error C2838: illegal qualified name in member declaration
C:\Beginning C++\CodeProject_Dialog2\CodeProject_Dialog2Dlg.cpp(41) : fatal error C1903: unable to recover from previous error(s); stopping compilation
Generating Code...
Error executing cl.exe.

CodeProject_Dialog2.exe - 18 error(s), 0 warning(s)
-----------------

header file:
--------------
// CodeProject_Dialog2Dlg.h : header file
//

#if !defined(AFX_CODEPROJECT_DIALOG2DLG_H__0FA170BA_1857_11D9_8F7A_444553540000__INCLUDED_)
#define AFX_CODEPROJECT_DIALOG2DLG_H__0FA170BA_1857_11D9_8F7A_444553540000__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

/////////////////////////////////////////////////////////////////////////////
// CCodeProject_Dialog2Dlg dialog

class CCodeProject_Dialog2Dlg : public CDialog
{
// Construction
public:
CCodeProject_Dialog2Dlg(CWnd* pParent = NULL); // standard constructor

// Dialog Data
//{{AFX_DATA(CCodeProject_Dialog2Dlg)
enum { IDD = IDD_CODEPROJECT_DIALOG2_DIALOG };
CListBox m_ProgTech;
CListBox m_YourFavoriteTech;
CString m_strFirstName;
BOOL m_bJava;
CString m_strLastName;
int m_nTitle;
BOOL m_bVisualBasic;
BOOL m_bVisualCpp;
int m_Win98;
//}}AFX_DATA

// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CCodeProject_Dialog2Dlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL

// Implementation
protected:
HICON m_hIcon;

// Generated message map functions
//{{AFX_MSG(CCodeProject_Dialog2Dlg)
virtual BOOL OnInitDialog();
afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
afx_msg void OnPaint();
afx_msg HCURSOR OnQueryDragIcon();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()

/***THIS IS WHAT I ADDED: *****/
private:
CString m_strFullInfo;

CString m_strOperatingSystem;

CString m_strProgLanguage;

public:
void PopulateProgTech();

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_CODEPROJECT_DIALOG2DLG_H__0FA170BA_1857_11D9_8F7A_444553540000__INCLUDED_)


.cpp file where a lot of the errors are:
------------

// CodeProject_Dialog2.cpp : Defines the class behaviors for the application.
//

#include "stdafx.h"
#include "CodeProject_Dialog2.h"
#include "CodeProject_Dialog2Dlg.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE

/*THE FIRST ERRORS POINT TO THIS LINE:*/
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CCodeProject_Dialog2App

BEGIN_MESSAGE_MAP(CCodeProject_Dialog2App, CWinApp)
//{{AFX_MSG_MAP(CCodeProject_Dialog2App)
// NOTE - the ClassWizard will add and remove mapping macros here.
// DO NOT EDIT what you see in these blocks of generated code!
//}}AFX_MSG
ON_COMMAND(ID_HELP, CWinApp::OnHelp)
END_MESSAGE_MAP()

---------------
AnswerRe: beginner: program corrupted somehow? Pin
Michael Dunn9-Oct-04 6:11
sitebuilderMichael Dunn9-Oct-04 6:11 
GeneralThanks!! Pin
7stud9-Oct-04 7:32
7stud9-Oct-04 7:32 
GeneralRe: Thanks!! Pin
IsaacLitingjun24-Nov-04 15:55
IsaacLitingjun24-Nov-04 15:55 
GeneralTAPI code Pin
mhp20048-Oct-04 22:42
mhp20048-Oct-04 22:42 
GeneralRe: TAPI code Pin
Michael P Butler8-Oct-04 23:20
Michael P Butler8-Oct-04 23:20 
GeneralSTL question Pin
Bob Stanneveld8-Oct-04 21:54
Bob Stanneveld8-Oct-04 21:54 
GeneralRe: STL question Pin
Nemanja Trifunovic9-Oct-04 3:57
Nemanja Trifunovic9-Oct-04 3:57 
GeneralRe: STL question Pin
Bob Stanneveld10-Oct-04 2:59
Bob Stanneveld10-Oct-04 2:59 
GeneralRe: STL question Pin
Kevin McFarlane9-Oct-04 4:03
Kevin McFarlane9-Oct-04 4:03 
GeneralRe: STL question Pin
Bob Stanneveld10-Oct-04 2:59
Bob Stanneveld10-Oct-04 2:59 
General8x8 Icon on Button control Pin
Murlai8-Oct-04 21:38
Murlai8-Oct-04 21:38 
GeneralConcurrency Issues & Inline Functions Pin
Ajoy8-Oct-04 19:58
Ajoy8-Oct-04 19:58 
GeneralRe: Concurrency Issues & Inline Functions Pin
Ravi Bhavnani9-Oct-04 6:49
professionalRavi Bhavnani9-Oct-04 6:49 
GeneralDatastructure lab Pin
El_Maco8-Oct-04 18:25
El_Maco8-Oct-04 18:25 
GeneralRe: Datastructure lab Pin
Ravi Bhavnani9-Oct-04 6:44
professionalRavi Bhavnani9-Oct-04 6:44 
GeneralRe: Datastructure lab Pin
Henry miller11-Oct-04 3:43
Henry miller11-Oct-04 3:43 
QuestionHow to code to stop a printer driver? Pin
DengJW8-Oct-04 17:56
DengJW8-Oct-04 17:56 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.