错误C2605未声明的标识符 [英] error C2605 undeclared identifier

查看:691
本文介绍了错误C2605未声明的标识符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在执行代码时遇到问题
错误是类的构造函数中的L未定义

 #define _AFXDLL
 #include   " 

 class  COurApp: public  CWinApp
{
  公共:
    虚拟 BOOL InitInstance();
};

 COurWnd:公共 CFrameWnd
{
  公共:
    // 构造函数
    COurWnd()
    {
      创建( 0 ,L " );
    }
};

BOOL COurApp :: InitInstance( void )
{
  m_pMainWnd =  COurWnd;
  m_pMainWnd-> ShowWindow(m_nCmdShow); //  ...并显示
  返回 TRUE;
}

COurApp AnApplication; 



[修改:使用前置标记可对您的代码进行格式化.另外,使用Tab键使其更具可读性.]

解决方案

L和字符串之间是否有空格?如果是这样,那将导致该错误.


但现在出现了2个错误
1)错误2)致命错误LNK1120:1个未解决的外部组件C:\ Users \ Nandisha \ Documents \ Visual Studio 2008 \ Projects \ 2 \ Debug \ 2.exe 2
2)错误1)错误LNK2019:function_tmainCRTStartup msvcrtd.lib 2中引用的未解析的外部符号_WinMain @ 16在这台机器上没有编译器,所以我无法测试,但是BOOL COurApp::InitInstance(void)是否不应该在类定义中并且不能单独存在?


M having problem executing the code
error is that L in constructor of class is undefined

#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.]

解决方案

Is there a space between the L and the string? If so, that''ll cause that error.


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


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?


这篇关于错误C2605未声明的标识符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆