problem in visual studio

hey... i have created 1 simple win console application in visual studio 10 but i am getting build error... wht it dat i know... some can solve plzz

[i][quote][b]
/* ----------- Header File : h.h-
---[/i]-------[/quote]--*[/b]/
#include<afxwin.h>



class CMyWnd : public CFrameWnd
{
public:
CMyWnd();

afx_msg void OnChar( UINT nChar, UINT nRepCnt, UINT nFlags );
afx_msg void OnLButtonDown( UINT nFlags, CPoint point );

DECLARE_MESSAGE_MAP( )

};

class CMyApp: public CWinApp
{
public :
BOOL InitInstance();
};
[i][b]/*------------- Source File : s.CPP -------------*/
/*------LBUTTON DOWN AND CHAR MESSAGE HENDLING--
---[/i]-*/[/b]
#include "h.h"
CMyWnd :: CMyWnd()
{
Create(NULL,"MyWindow");
}
BOOL CMyApp :: InitInstance()
{
CMyWnd *c=new CMyWnd();
m_pMainWnd=c;
m_pMainWnd->ShowWindow(SW_SHOW);
AfxMessageBox("hOW R U");
return true;
}
BEGIN_MESSAGE_MAP(CMyWnd , CFrameWnd )
ON_WM_CHAR()
ON_WM_LBUTTONDOWN( )
END_MESSAGE_MAP( )

void CMyWnd::OnChar ( UINT nChar, UINT nRepCnt, UINT nFlags )

{

AfxMessageBox(" KEY PRESSED ");

}

void CMyWnd:: OnLButtonDown( UINT nFlags, CPoint point )


{


AfxMessageBox(" L BUTTON DOWN ");

}

CMyApp app;

[b]the error i am getting[/b]

1>------ Build started: Project: kk, Configuration: Debug Win32 ------
1> c.cpp
1>c:\program files\microsoft visual studio 10.0\vc\atlmfc\include\afx.h(24): fatal error C1189: #error : Building MFC application with /MD[d] (CRT dll version) requires MFC shared dll version. Please #define _AFXDLL or do not use /MD[d]
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
plz help sm 1
i have created 1 simple win console application in visual studio 10

You need to start again, this time creating an MFC application (not a console one; you trying to use a window in your code).

It is possible to fix your original app, but it is prob harder than just starting again. You'll (at least) have to:
a) change the general options to use MFC
b) change the subsystem to Windows from Console
c) prob. add assorted #defines
d) ...

Andy
Last edited on
Topic archived. No new replies allowed.