Click here to Skip to main content
16,004,806 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
M having problem executing the code
error is that L in constructor of class is undefined

C
#define _AFXDLL
#include "afxwin.h"

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

class COurWnd:public CFrameWnd
{
  public:
    // Constructor
    COurWnd()
    {
      Create(0,L "our dumb window application");
    }
};

BOOL COurApp::InitInstance(void)
{
  m_pMainWnd = new COurWnd;
  m_pMainWnd->ShowWindow(m_nCmdShow); // ...and display it
  return TRUE;
}

COurApp AnApplication;


[Modified: using pre tags gives your code formatting. Also, using the tab key makes it more readable.]
Posted
Updated 8-Jul-10 7:40am
v2
Comments
nandisha 8-Jul-10 14:05pm    
thanks but that wont help with the errors ... thanks neways..
OriginalGriff 8-Jul-10 14:17pm    
No, but it is:

A) Polite
B) Easier to read.

Fulfilling these two criteria mean a better chance of getting a polite, useful answer.
We aren't paid to be here, so rudeness, and hard to read code do not encourage us to reply positively.
You should instead note what William has done, and apply it to any further questions you may have.
nandisha 8-Jul-10 15:10pm    
okay... ll take care

Is there a space between the L and the string? If so, that'll cause that error.
 
Share this answer
 
Comments
William Winner 8-Jul-10 13:42pm    
Reason for my vote of 5
that does appear to be the problem.
but now its giving 2 errors
1)Error 2) fatal error LNK1120: 1 unresolved externals C:\Users\Nandisha\Documents\Visual Studio 2008\Projects\2\Debug\2.exe 2
2)Error 1) error LNK2019: unresolved external symbol _WinMain@16 referenced in function_tmainCRTStartup msvcrtd.lib 2
 
Share this answer
 
Comments
William Winner 8-Jul-10 14:17pm    
well, your first question was solved...specifically about L being undeclared.

You appear to have other issues. With your other issues, you may want a new question with more code.

Also, as an FYI, you can comment on someone's answer, and posting an "answer" that isn't one is frowned upon.
OriginalGriff 8-Jul-10 14:19pm    
Don't add a reply to your own question - all that happens is that you get an email to say there is a reply. Instead, add a comment to the reply - that way the author gets an email just like this one to say there is more information available.
nandisha 8-Jul-10 14:40pm    
okay...ll make sure in future
nandisha 8-Jul-10 14:43pm    
thanks griff
It's been a while since I've done c++ and I don't have a compiler on this machine, so I can't test, but shouldn't BOOL COurApp::InitInstance(void) be within a class definition and not standing alone?
 
Share this answer
 
Comments
nandisha 8-Jul-10 15:12pm    
thanks , then what shud b done

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900