error in a very simple VC++ program
-
hye, I m new to VC++ i wrote a simple program in VC++ following is the code : #include class CMainWin :public CFrameWnd { public: CMainWin(); Declare_Message_Map() }; CMainWin ::CMainWin() { Create(NULL,"Hello"); } class CApp:public CWinApp { bool InitInstace(); }; Bool CApp :: InitInstance() { m_pMainWnd=new MainWin; m_pMainWnd ->ShowWindow(m_nCmdShow); m_pMainWnd ->UpdateWindow(); return true; } Begin_Message_Map(CMainWin,CFrameWnd) End_Message_Map() CApp App; but i m gtng two errors 1) syntax error : missing ';' before type 'long' 2)fatal error C1004: unexpected end of file found Neha
-
hye, I m new to VC++ i wrote a simple program in VC++ following is the code : #include class CMainWin :public CFrameWnd { public: CMainWin(); Declare_Message_Map() }; CMainWin ::CMainWin() { Create(NULL,"Hello"); } class CApp:public CWinApp { bool InitInstace(); }; Bool CApp :: InitInstance() { m_pMainWnd=new MainWin; m_pMainWnd ->ShowWindow(m_nCmdShow); m_pMainWnd ->UpdateWindow(); return true; } Begin_Message_Map(CMainWin,CFrameWnd) End_Message_Map() CApp App; but i m gtng two errors 1) syntax error : missing ';' before type 'long' 2)fatal error C1004: unexpected end of file found Neha
Use: #include "stdafx.h" and then try. for all string, write: _T("") instead of "". For example, write _T("Hello") instead of "Hello". I think this will help.
Anurag Gandhi.
-
hye, I m new to VC++ i wrote a simple program in VC++ following is the code : #include class CMainWin :public CFrameWnd { public: CMainWin(); Declare_Message_Map() }; CMainWin ::CMainWin() { Create(NULL,"Hello"); } class CApp:public CWinApp { bool InitInstace(); }; Bool CApp :: InitInstance() { m_pMainWnd=new MainWin; m_pMainWnd ->ShowWindow(m_nCmdShow); m_pMainWnd ->UpdateWindow(); return true; } Begin_Message_Map(CMainWin,CFrameWnd) End_Message_Map() CApp App; but i m gtng two errors 1) syntax error : missing ';' before type 'long' 2)fatal error C1004: unexpected end of file found Neha
Dear Neha, One thing is that, your project might have enabled precompiled header. So that you have to include stdafx.h in your project or remove the pre-compiled header setting for the file from project properties. Declare_Message_Map() is actually DECLARE_MESSAGE_MAP() hope you are aware about this. Please put the right source code and complete error message to get your problem solved. I think you can approach Visual C++ Create Simple SDI for you. I doubt your "Create" function will succeed because you have to give a valid class name for the window.
-Sarath_._ "Great hopes make everything great possible" - Benjamin Franklin
My blog - Sharing My Thoughts, An Article - Understanding Statepattern
-
Use: #include "stdafx.h" and then try. for all string, write: _T("") instead of "". For example, write _T("Hello") instead of "Hello". I think this will help.
Anurag Gandhi.
-
Dear Neha, One thing is that, your project might have enabled precompiled header. So that you have to include stdafx.h in your project or remove the pre-compiled header setting for the file from project properties. Declare_Message_Map() is actually DECLARE_MESSAGE_MAP() hope you are aware about this. Please put the right source code and complete error message to get your problem solved. I think you can approach Visual C++ Create Simple SDI for you. I doubt your "Create" function will succeed because you have to give a valid class name for the window.
-Sarath_._ "Great hopes make everything great possible" - Benjamin Franklin
My blog - Sharing My Thoughts, An Article - Understanding Statepattern
-
Please post the correct code and error messages. Are you dealing everything in a single CPP file?
-Sarath_._ "Great hopes make everything great possible" - Benjamin Franklin
My blog - Sharing My Thoughts, An Article - Understanding Statepattern
-
Please post the correct code and error messages. Are you dealing everything in a single CPP file?
-Sarath_._ "Great hopes make everything great possible" - Benjamin Franklin
My blog - Sharing My Thoughts, An Article - Understanding Statepattern
Foloowing is the corrected code written in file called example.cpp: #include class CMainWin :public CFrameWnd { public: CMainWin(); DECLARE_MESSAGE_MAP() }; CMainWin ::CMainWin() { Create(NULL,"Hello"); } class CApp:public CWinApp { public: bool InitInstance(); }; Bool CApp :: InitInstance() { m_pMainWnd= new CMainWin; m_pMainWnd ->ShowWindow(m_nCmdShow); m_pMainWnd ->UpdateWindow(); return TRUE; } BEGIN_MESSAGE_MAP(CMainWin,CFrameWnd) END_MESSAGE_MAP() CApp App; following error r encountered: 1)c:\program files\microsoft visual studio\vc98\include\winnt.h(86) : error C2144: syntax error : missing ';' before type 'long' 2)c:\program files\microsoft visual studio\vc98\include\winnt.h(86) : fatal error C1004: unexpected end of file found neha
-
Foloowing is the corrected code written in file called example.cpp: #include class CMainWin :public CFrameWnd { public: CMainWin(); DECLARE_MESSAGE_MAP() }; CMainWin ::CMainWin() { Create(NULL,"Hello"); } class CApp:public CWinApp { public: bool InitInstance(); }; Bool CApp :: InitInstance() { m_pMainWnd= new CMainWin; m_pMainWnd ->ShowWindow(m_nCmdShow); m_pMainWnd ->UpdateWindow(); return TRUE; } BEGIN_MESSAGE_MAP(CMainWin,CFrameWnd) END_MESSAGE_MAP() CApp App; following error r encountered: 1)c:\program files\microsoft visual studio\vc98\include\winnt.h(86) : error C2144: syntax error : missing ';' before type 'long' 2)c:\program files\microsoft visual studio\vc98\include\winnt.h(86) : fatal error C1004: unexpected end of file found neha
What file you are supposed include at #include statement at the very beginning?
-Sarath_._ "Great hopes make everything great possible" - Benjamin Franklin
My blog - Sharing My Thoughts, An Article - Understanding Statepattern
-
What file you are supposed include at #include statement at the very beginning?
-Sarath_._ "Great hopes make everything great possible" - Benjamin Franklin
My blog - Sharing My Thoughts, An Article - Understanding Statepattern
Sorry following is the code: #include class CMainWin :public CFrameWnd { public: CMainWin(); DECLARE_MESSAGE_MAP() }; CMainWin ::CMainWin() { Create(NULL,"Hello"); } class CApp:public CWinApp { public: bool InitInstance(); }; Bool CApp :: InitInstance() { m_pMainWnd= new CMainWin; m_pMainWnd ->ShowWindow(m_nCmdShow); m_pMainWnd ->UpdateWindow(); return TRUE; } BEGIN_MESSAGE_MAP(CMainWin,CFrameWnd) END_MESSAGE_MAP() CApp App; neha -- modified at 7:15 Wednesday 23rd May, 2007 neha
-
Sorry following is the code: #include class CMainWin :public CFrameWnd { public: CMainWin(); DECLARE_MESSAGE_MAP() }; CMainWin ::CMainWin() { Create(NULL,"Hello"); } class CApp:public CWinApp { public: bool InitInstance(); }; Bool CApp :: InitInstance() { m_pMainWnd= new CMainWin; m_pMainWnd ->ShowWindow(m_nCmdShow); m_pMainWnd ->UpdateWindow(); return TRUE; } BEGIN_MESSAGE_MAP(CMainWin,CFrameWnd) END_MESSAGE_MAP() CApp App; neha -- modified at 7:15 Wednesday 23rd May, 2007 neha
-
i dnt know is this a problem in printing or what??? but i have included afxwin.h -- modified at 7:25 Wednesday 23rd May, 2007
Sorry Neha, I could not see any bug in your code unless some spelling mistakes
#include <afxwin.h> class CMainWin :public CFrameWnd { public: CMainWin(); DECLARE_MESSAGE_MAP() }; CMainWin ::CMainWin() { Create(NULL,"Hello"); } class CApp:public CWinApp { public: BOOL InitInstance(); }; BOOL CApp :: InitInstance() { m_pMainWnd= new CMainWin; m_pMainWnd ->ShowWindow(m_nCmdShow); m_pMainWnd ->UpdateWindow(); return TRUE; } BEGIN_MESSAGE_MAP(CMainWin,CFrameWnd) END_MESSAGE_MAP() CApp App;
The above code worked fine for me. -- modified at 8:31 Wednesday 23rd May, 2007-Sarath_._ "Great hopes make everything great possible" - Benjamin Franklin
My blog - Sharing My Thoughts, An Article - Understanding Statepattern
-
Foloowing is the corrected code written in file called example.cpp: #include class CMainWin :public CFrameWnd { public: CMainWin(); DECLARE_MESSAGE_MAP() }; CMainWin ::CMainWin() { Create(NULL,"Hello"); } class CApp:public CWinApp { public: bool InitInstance(); }; Bool CApp :: InitInstance() { m_pMainWnd= new CMainWin; m_pMainWnd ->ShowWindow(m_nCmdShow); m_pMainWnd ->UpdateWindow(); return TRUE; } BEGIN_MESSAGE_MAP(CMainWin,CFrameWnd) END_MESSAGE_MAP() CApp App; following error r encountered: 1)c:\program files\microsoft visual studio\vc98\include\winnt.h(86) : error C2144: syntax error : missing ';' before type 'long' 2)c:\program files\microsoft visual studio\vc98\include\winnt.h(86) : fatal error C1004: unexpected end of file found neha
tyagineha wrote:
#include <afxwin.h>
This should be "stdafx.h" instead.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
-
what u suggested is not working (stdafx.h) also,i m using create function then how to use : _T("Hello") instead of "Hello". neha
Whats header file of your program ?
WhiteSky