c++ - Entry point for MFC application -
i have created new emty project. have added cpp , header hello world files taken jeff prosise 'programming windows mfc' book. have set use of mfc
use mfc in shared dll
got error entry point must defined
how fix problem?
cpp:
#include <afxwin.h> #include "hello.h" cmyapp myapp; ///////////////////////////////////////////////////////////////////////// // cmyapp member functions bool cmyapp::initinstance () { m_pmainwnd = new cmainwindow; m_pmainwnd->showwindow (m_ncmdshow); m_pmainwnd->updatewindow (); return true; } ///////////////////////////////////////////////////////////////////////// // cmainwindow message map , member functions begin_message_map (cmainwindow, cframewnd) on_wm_paint () end_message_map () cmainwindow::cmainwindow () { create (null, _t ("the hello application")); } void cmainwindow::onpaint () { cpaintdc dc (this); crect rect; getclientrect (&rect); dc.drawtext (_t ("hello, mfc"), -1, &rect, dt_singleline | dt_center | dt_vcenter); }
h:
class cmyapp : public cwinapp { public: virtual bool initinstance (); }; class cmainwindow : public cframewnd { public: cmainwindow (); protected: afx_msg void onpaint (); declare_message_map () };
you need tell compiler use winmain
(which provided mfc: http://msdn.microsoft.com/en-us/library/akdx0603.aspx) instead of main
entry point.
right click project, select properties
, , navigate linker
-> system
-> subsystem
. change subsystem
windows
.
Comments
Post a Comment