Win32 App not compiling???

This is a discussion on Win32 App not compiling??? within the C++ Programming forums, part of the General Programming Boards category; Why is this not working????? #include <afxwin.h> class COurAppublic:CWinApp { public: virtual BOOL InitInstance(); }; class COurWndublic:CFrameWnd { public: COurWnd() ...

  1. #1
    grmoo
    Guest

    Question Win32 App not compiling???

    Why is this not working?????

    #include <afxwin.h>

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

    class COurWndublic:CFrameWnd
    {
    public:
    COurWnd()
    {
    Create(0, "Holy Cow!!");
    }
    };

    BOOL COurApp::InitInstance(void)
    {
    m_pMainWnd = new COurWnd;
    m_pMainWnd->ShowWindow(m_nCmdShow);
    return true;
    }
    COurApp Application;

  2. #2
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Posts
    5,789
    Code:
    #include <afxwin.h>
    
    class COurApp:CWinApp
    {
    public:
    	virtual BOOL InitInstance();
    };
    
    class COurWnd: public CFrameWnd
    {
    public:
    	COurWnd(){Create(0, "Holy Cow!!");}
    
    };
    
    BOOL COurApp::InitInstance(void)
    {
    	m_pMainWnd = new COurWnd;
    	m_pMainWnd->ShowWindow(m_nCmdShow);
    	return TRUE;
    }
    
    
    COurApp Application;

  3. #3
    grmoo
    Guest
    msvcrtd.lib(crtexe.obj) : error LNK2001: unresolved external symbol _main
    Debug/Wind.exe : fatal error LNK1120: 1 unresolved externals

    these are the errors i get!

  4. #4
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Posts
    5,789
    Compile as a Win32 App...not a console....

    then

    Projects->Settings->general->Microsoft Foundation Classes->Use MFC in a shared Dll

  5. #5
    grmoo
    Guest
    yeah i did that

  6. #6
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    Posts
    6,231
    Originally posted by grmoo
    yeah i did that
    ... and what happened? Did it work or not? If not, what errors are you getting now?
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

  7. #7
    I lurk
    Join Date
    Aug 2002
    Posts
    1,361
    Project -> Settings -> C/C++ -> Project Options -> Remove the entry "/subsystem:console"

  8. #8
    grmoo
    Guest
    These are the errors that i got whenididall that

    msvcrtd.lib(crtexe.obj) : error LNK2001: unresolved external symbol _main
    Debug/Cpp1.exe : fatal error LNK1120: 1 unresolved externals

  9. #9
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    Posts
    6,231
    You have actually written a main() funtion, right?
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

  10. #10
    Refugee face_master's Avatar
    Join Date
    Aug 2001
    Posts
    2,052
    lol! Thats embarrasing!

  11. #11
    Skunkmeister Stoned_Coder's Avatar
    Join Date
    Aug 2001
    Posts
    2,572
    your code doesnt compile because of typos.
    Fordys code will compile fine. I suggest u start a new workspace.use win32 app from list. make new cpp file and paste fordys code in. goto project/settings and make sure u r using mfc in a shared dll. compile and build fordys code. what happens now?
    Free the weed!! Class B to class C is not good enough!!
    And the FAQ is here :- http://faq.cprogramming.com/cgi-bin/smartfaq.cgi

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Screwy Linker Error - VC2005
    By Tonto in forum C++ Programming
    Replies: 5
    Last Post: 06-19-2007, 02:39 PM
  2. Problems compiling this SDL app
    By Rider in forum C++ Programming
    Replies: 3
    Last Post: 03-27-2007, 12:22 PM
  3. compiling and executing issue with lcc win32
    By GanglyLamb in forum C Programming
    Replies: 10
    Last Post: 12-22-2004, 01:24 PM
  4. confusion win32 -console app
    By GanglyLamb in forum C Programming
    Replies: 2
    Last Post: 06-11-2003, 10:12 AM
  5. win32 and consele app.
    By master2000 in forum C++ Programming
    Replies: 5
    Last Post: 12-22-2002, 10:50 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21