error while creating a window in C++

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • shakthi
    New Member
    • Sep 2006
    • 13

    error while creating a window in C++

    hi,
    am very much new to C++ windows programming.i took the foll code from net and just ran on MSVS2005.I get no compliation error.But when i buid it, it shows the foll errors:




    1>------ Build started: Project: testcon, Configuration: Debug Win32 ------
    1>Linking...
    1>libcmtd.lib(c rt0.obj) : error LNK2019: unresolved external symbol _main referenced in function ___tmainCRTStar tup
    1>C:\SAMPLES\te stcon\Debug\tes tcon.exe : fatal error LNK1120: 1 unresolved externals
    1>Build log was saved at "file://c:\SAMPLES\test con\testcon\Deb ug\BuildLog.htm "
    1>testcon - 2 error(s), 0 warning(s)
    ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

    Every Cpp progrm should have an entry point.that is the main.i dont find any main in tht code.what shuold i do now.please guide me....


    the code is as follows:


    #include <afxwin.h>
    #include<window s.h>


    class CHello : public CFrameWnd
    {
    public:
    CHello()
    {
    Create(NULL,_T( "Hello World!"),WS_OVE RLAPPEDWINDOW,r ectDefault);
    }
    };

    class CHelloApp : public CWinApp
    {
    public:
    virtual BOOL InitInstance();
    };

    BOOL CHelloApp::Init Instance()
    {
    m_pMainWnd = new CHello();
    m_pMainWnd->ShowWindow(m_n CmdShow);
    m_pMainWnd->UpdateWindow() ;
    return TRUE;
    }

    CHelloApp theApp;





    thanks a lot in advance

    regards,
    ak
  • dtimes6
    New Member
    • Oct 2006
    • 73

    #2
    This Error might be some project's config is not right. Might be the type of your exe

    Comment

    Working...