Thread: What Hit this Code!!!!

  1. #1
    Unregistered
    Guest

    What Hit this Code!!!!

    this Code is not work ??? Why

    [cod]
    #include<afxwin.h>

    class mywin ublic CFrameWnd
    {
    mywin()
    {
    Create(NULL,"Esmaee.com");
    }
    };
    class app: public CWinApp
    {
    BOOL InitInstance()
    {

    m_pMainWnd=new CFrameWnd();
    m_pMainWnd->ShowWindow(m_nCmdShow);
    return TRUE;

    }
    };

    app aap;
    [/cod]

    I have to creat and show window but instead this I recieve this message :

    --------------------Configuration: Cpp1 - Win32 Debug--------------------
    Linking...
    libcmtd.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
    Debug/Cpp1.exe : fatal error LNK1120: 1 unresolved externals
    Error executing link.exe.

    please Help!!!

  2. #2
    Registered User
    Join Date
    Apr 2002
    Posts
    1,571
    It's looking for main( ) because you have created a win32 console application instead of a win32 application probably. Just go into Project->Settings->Link .. then under Project Settings: look for the line:

    /subsystem:console

    and change that to

    /subsystem:windows

    You should be set. Next time make your project a Win32 Application , no console!
    "...the results are undefined, and we all know what "undefined" means: it means it works during development, it works during testing, and it blows up in your most important customers' faces." --Scott Meyers

  3. #3
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Posts
    5,793
    Also, as you are creating an MFC app.....when you create the project chose MFC Application as opposed to Win32 Application or Console Application...this will bring in the nessasary settings and libraries

  4. #4
    Unregistered
    Guest
    Thank you!
    I have done...
    Now I don't recieve link message!
    I recieve an warning from the Windows:

    -------------------------------------------
    Debug Assertion Failed!
    Program : C:\................................ .exe
    File: winocc.cpp
    Line: 301
    For information on how your program can cause an assertion
    faolure,see.................................
    -----------[aburt]--------[Retry]-----------[Ignor]------
    when I sellect retry I recieve the will known message:

    Cpp1.exe has encountered a problem and needs to close. We are sorry for the inconvenience.
    [send report] [don't send]
    !!!!!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Enforcing Machine Code Restrictions?
    By SMurf in forum Tech Board
    Replies: 21
    Last Post: 03-30-2009, 07:34 AM
  2. Values changing without reason?
    By subtled in forum C Programming
    Replies: 2
    Last Post: 04-19-2007, 10:20 AM
  3. Updated sound engine code
    By VirtualAce in forum Game Programming
    Replies: 8
    Last Post: 11-18-2004, 12:38 PM
  4. Interface Question
    By smog890 in forum C Programming
    Replies: 11
    Last Post: 06-03-2002, 05:06 PM
  5. Replies: 0
    Last Post: 02-21-2002, 06:05 PM