Click here to Skip to main content
16,008,490 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: scope in functions Pin
jhwurmbach15-Apr-07 22:57
jhwurmbach15-Apr-07 22:57 
Questionerror C2653: 'TryIt' : is not a class or namespace name Pin
nathan715-Apr-07 21:10
nathan715-Apr-07 21:10 
AnswerRe: error C2653: 'TryIt' : is not a class or namespace name Pin
Programm3r15-Apr-07 21:24
Programm3r15-Apr-07 21:24 
AnswerRe: error C2653: 'TryIt' : is not a class or namespace name Pin
toxcct15-Apr-07 22:23
toxcct15-Apr-07 22:23 
AnswerRe: error C2653: 'TryIt' : is not a class or namespace name Pin
cp987616-Apr-07 0:00
cp987616-Apr-07 0:00 
GeneralRe: error C2653: 'TryIt' : is not a class or namespace name Pin
Michael Dunn16-Apr-07 10:24
sitebuilderMichael Dunn16-Apr-07 10:24 
GeneralRe: error C2653: 'TryIt' : is not a class or namespace name Pin
Mark Salsbery16-Apr-07 10:31
Mark Salsbery16-Apr-07 10:31 
GeneralRe: error C2653: 'TryIt' : is not a class or namespace name Pin
cp987616-Apr-07 18:44
cp987616-Apr-07 18:44 
Mike's right - from MSDN:[^]
------------------------------------------------------------
AppWizard puts the line "#include 'stdafx.h'" as one of the first lines in every .CPP file in a project. Because of the compiler options being used by projects generated with AppWizard, anything up to and including "stdafx.h" in a .CPP file is considered by the compiler to be part of a precompiled header.

The problem with this is that when you edit the .CPP files and insert #includes, #defines, declarations, or other code before the "#include 'stdafx.h'" line, all of it is ignored by the compiler. This is the correct behavior because when the compiler is using the precompiled header, it starts to compile the code in the .CPP file after skipping past the "stdafx.h" line.

This behavior can lead to compiler errors that do not seem to make sense, because it appears that you are including all the needed declarations and header files in the .CPP file. For example, some of the errors that may result are the following:

• error C2065: 'CTestClass' : undeclared identifier
• error C2146: syntax error : missing ';' before identifier 'tc'
• error C2064: term does not evaluate to a function
------------------------------------------------------------

The last time I made this mistake was in VC6, and there, if I recall correctly, the compiler clagged - gave some warning that the include files up to stdafx.h did not match those it precompiled.

By the way, what is a 'public class', I know that for nested classes you can have public / private etc, but in global scope? What would a private class do?



Peter
"Until the invention of the computer, the machine gun was the device that enabled humans to make the most mistakes in the smallest amount of time."

GeneralRe: error C2653: 'TryIt' : is not a class or namespace name Pin
nathan716-Apr-07 23:46
nathan716-Apr-07 23:46 
GeneralRe: error C2653: 'TryIt' : is not a class or namespace name Pin
Mark Salsbery17-Apr-07 6:25
Mark Salsbery17-Apr-07 6:25 
GeneralRe: error C2653: 'TryIt' : is not a class or namespace name Pin
JudyL_MD17-Apr-07 8:00
JudyL_MD17-Apr-07 8:00 
GeneralRe: error C2653: 'TryIt' : is not a class or namespace name Pin
Mark Salsbery17-Apr-07 8:06
Mark Salsbery17-Apr-07 8:06 
GeneralRe: error C2653: 'TryIt' : is not a class or namespace name Pin
JudyL_MD17-Apr-07 8:12
JudyL_MD17-Apr-07 8:12 
GeneralRe: error C2653: 'TryIt' : is not a class or namespace name Pin
cp987617-Apr-07 13:20
cp987617-Apr-07 13:20 
GeneralRe: error C2653: 'TryIt' : is not a class or namespace name Pin
Michael Dunn17-Apr-07 18:14
sitebuilderMichael Dunn17-Apr-07 18:14 
QuestionControl Font Pin
baerten15-Apr-07 21:04
baerten15-Apr-07 21:04 
AnswerRe: Control Font Pin
Gospodin Baron15-Apr-07 22:05
Gospodin Baron15-Apr-07 22:05 
AnswerRe: Control Font Pin
Hamid_RT15-Apr-07 22:13
Hamid_RT15-Apr-07 22:13 
NewsRe: Control Font Pin
baerten16-Apr-07 0:34
baerten16-Apr-07 0:34 
GeneralRe: Control Font Pin
Hamid_RT16-Apr-07 0:51
Hamid_RT16-Apr-07 0:51 
QuestionDHCP identification? Pin
Sunil P V15-Apr-07 20:43
Sunil P V15-Apr-07 20:43 
QuestionForms Pin
ibhelmer15-Apr-07 20:39
ibhelmer15-Apr-07 20:39 
AnswerRe: Forms Pin
baerten15-Apr-07 21:06
baerten15-Apr-07 21:06 
AnswerRe: Forms Pin
toxcct15-Apr-07 22:47
toxcct15-Apr-07 22:47 
QuestionHow to change the colour of a mainframe or dialog Pin
yaminisridaran15-Apr-07 20:05
yaminisridaran15-Apr-07 20:05 

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.