| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1195 人关注过本帖
标题:error C2143: syntax error : missing ';' before '}'
取消只看楼主 加入收藏
nedly
Rank: 1
等 级:新手上路
帖 子:5
专家分:0
注 册:2012-2-15
结帖率:100%
收藏
 问题点数:0 回复次数:0 
error C2143: syntax error : missing ';' before '}'
下面是我的代码:

程序代码:
#include "stdafx.h"
#include "dlg.h"
#include "dlgDlg.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CAboutDlg dialog used for App About
/************************************************
*           CDlgDlg类
*            主界面
*
*   头文件为 dlgDlg.h
*
*   源文件 dlgDlg.cpp         
*************************************************/

class CAboutDlg : public CDialog
{
public:
    CAboutDlg();

// Dialog Data
    //{{AFX_DATA(CAboutDlg)
    enum { IDD = IDD_ABOUTBOX };
    //}}AFX_DATA

    // ClassWizard generated virtual function overrides
    //{{AFX_VIRTUAL(CAboutDlg)
    protected:
    virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
    //}}AFX_VIRTUAL

// Implementation
protected:
    //{{AFX_MSG(CAboutDlg)
    //}}AFX_MSG
    DECLARE_MESSAGE_MAP()
};

CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
{
    //{{AFX_DATA_INIT(CAboutDlg)
    //}}AFX_DATA_INIT
}

void CAboutDlg::DoDataExchange(CDataExchange* pDX)
{
    CDialog::DoDataExchange(pDX);
    //{{AFX_DATA_MAP(CAboutDlg)
    //}}AFX_DATA_MAP
}

BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
    //{{AFX_MSG_MAP(CAboutDlg)
        // No message handlers
    //}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CDlgDlg dialog

CDlgDlg::CDlgDlg(CWnd* pParent /*=NULL*/)
    : CDialog(CDlgDlg::IDD, pParent)
    , m_iRadioRx(0)
{
    //{{AFX_DATA_INIT(CDlgDlg)
    m_strRXData = _T("");
    m_strTXData = _T("");
    m_strSerialPort = _T("");
    m_strSerialStop = _T("");
    m_strSerialData = _T("");
    m_strSerialCheck = _T("");
    m_strSerialBaud = _T("");
    //}}AFX_DATA_INIT
    // Note that LoadIcon does not require a subsequent DestroyIcon in Win32
    m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);

    m_bOpenPort = TRUE;     //显示"打开串口"
    m_bMouseDown  = FALSE;  //标志位初始化
    m_bRxFlag     = FALSE;
    rxUndeeChange = FALSE;
    rxIndex = 0;
    rxLen = 7;
    dGrid = 110;
}
CDlgDlg::~CDlgDlg()
{
}

void CDlgDlg::DoDataExchange(CDataExchange* pDX)
{
    CDialog::DoDataExchange(pDX);
    //{{AFX_DATA_MAP(CDlgDlg)
    DDX_Control(pDX, IDC_BUTTON_OPENCOM, m_cbOpenCom);
    DDX_Text(pDX, IDC_EDIT_RXDATA, m_strRXData);
    DDX_Text(pDX, IDC_EDIT_TXDATA, m_strTXData);
    DDX_Control(pDX, IDC_MSCOMM1, m_ctrlComm);
    DDX_CBString(pDX, IDC_COMBO_PORT, m_strSerialPort);
    DDX_CBString(pDX, IDC_COMBO_STOP, m_strSerialStop);
    DDX_CBString(pDX, IDC_COMBO_DATA, m_strSerialData);
    DDX_CBString(pDX, IDC_COMBO_CHECK, m_strSerialCheck);
    DDX_CBString(pDX, IDC_COMBO_BAUD, m_strSerialBaud);
    //}}AFX_DATA_MAP
    DDX_Control(pDX, IDC_STATIC_PLOT, m_puShow);
    DDX_Control(pDX, IDC_LIST1, m_list);
    DDX_Radio(pDX, IDC_RADIO1, m_iRadioRx);
}
// 对话框 消息映射表
BEGIN_MESSAGE_MAP(CDlgDlg, CDialog)
    //{{AFX_MSG_MAP(CDlgDlg)
    ON_WM_SYSCOMMAND()
    ON_WM_PAINT()
    ON_WM_QUERYDRAGICON()
    ON_BN_CLICKED(IDC_BUTTON_MANUALSEND, OnButtonManualsend)
    ON_BN_CLICKED(IDC_BUTTON_OPENCOM, OnButtonOpencom)
    ON_WM_TIMER()
    ON_WM_MOUSEWHEEL()
    ON_WM_MOUSEMOVE()
    ON_WM_LBUTTONDOWN()
    ON_WM_LBUTTONUP()
    ON_BN_CLICKED(IDC_BUTTON_LIST_INSERT, &CDlgDlg::OnBnClickedButtonListInsert)
    ON_BN_CLICKED(IDC_BUTTON_LIST_DEL, &CDlgDlg::OnBnClickedButtonListDel)
    ON_BN_CLICKED(IDC_BUTTON_LIST_DELETE, &CDlgDlg::OnBnClickedButtonListDelete)
    ON_BN_CLICKED(IDC_BUTTON_LIST_FILE, &CDlgDlg::OnBnClickedButtonListFile)
    ON_BN_CLICKED(IDC_BTN_RX, &CDlgDlg::OnBnClickedBtnRx)
    ON_NOTIFY(LVN_ITEMACTIVATE, IDC_LIST1, &CDlgDlg::OnLvnItemActivateList1)
    ON_BN_CLICKED(IDC_BTN_STUDY, &CDlgDlg::OnBnClickedBtnStudy)
    ON_BN_CLICKED(IDC_BTN_QUERY, &CDlgDlg::OnBnClickedBtnQuery)
    ON_WM_RBUTTONDOWN()
    ON_COMMAND(ID_GRID_SET, &CDlgDlg::OnGridSet)
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CDlgDlg message handlers
/****************************************************
*               对话框初始化
*
****************************************************/
BOOL CDlgDlg::OnInitDialog()
{
    CDialog::OnInitDialog();

    // Add "About..." menu item to system menu.

    // IDM_ABOUTBOX must be in the system command range.
    ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
    ASSERT(IDM_ABOUTBOX < 0xF000);

    CMenu* pSysMenu = GetSystemMenu(FALSE);
    if (pSysMenu != NULL)
    {
        CString strAboutMenu;
        strAboutMenu.LoadString(IDS_ABOUTBOX);
        if (!strAboutMenu.IsEmpty())
        {
            pSysMenu->AppendMenu(MF_SEPARATOR);
            pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
        }
    }

    // Set the icon for this dialog.  The framework does this automatically
    //  when the application's main window is not a dialog
    SetIcon(m_hIcon, TRUE);            // Set big icon
    SetIcon(m_hIcon, FALSE);        // Set small icon
    
    m_iRadioRx = 1;
    UpdateData( FALSE );
    //发送模式初始化
    ( (CComboBox*)GetDlgItem(IDC_COMBO_OUTPUT) )->AddString("按ASCII码");
    ( (CComboBox*)GetDlgItem(IDC_COMBO_OUTPUT) )->AddString("按十六进制");
    ( (CComboBox*)GetDlgItem(IDC_COMBO_OUTPUT) )->SetCurSel(1);  //初始化显示

    //串口设置组合框初始化显示
    ( (CComboBox*)GetDlgItem(IDC_COMBO_PORT) )->SetCurSel(0);  //串口
    ( (CComboBox*)GetDlgItem(IDC_COMBO_BAUD) )->SetCurSel(5);  //波特率
    ( (CComboBox*)GetDlgItem(IDC_COMBO_CHECK) )->SetCurSel(0); //校验位
    ( (CComboBox*)GetDlgItem(IDC_COMBO_DATA) )->SetCurSel(2);  //数据位
    ( (CComboBox*)GetDlgItem(IDC_COMBO_STOP) )->SetCurSel(0);  //停止位

    //波形数据初始化
    rxUndee[0] = 0xFF;
    rxUndee[1] = 0;
    rxUndee[2] = 0;     //初始化
    rxUndee[3] = 0xFF;
    rxUndee[4] = 0;
    rxUndee[5] = 0xFF;
    fnInitPlotUndee();
    m_puShow.SetUndeeData( m_aXDlg,m_aYDlg,m_AxisCenter );
    m_puShow.InitPlotUndee();
    
    //学习初始化
    GetDlgItem(IDC_STATIC_STUDY)->ShowWindow(SW_HIDE);
    
    //键值列表框初始化
    m_list.SetExtendedStyle( LVS_EX_GRIDLINES | LVS_EX_FULLROWSELECT );    //设置列表控件格式
    m_list.InsertColumn( 0,"编号",LVCFMT_CENTER,40 );
    m_list.InsertColumn( 1,"用户码1",LVCFMT_CENTER,55 );
    m_list.InsertColumn( 2,"用户码2",LVCFMT_CENTER,55 );
    m_list.InsertColumn( 3,"键值",LVCFMT_CENTER,40 );
    m_list.InsertColumn( 4,"反码",LVCFMT_CENTER,40 );
    
    //控制台按钮初始化
    int index = 0;   
    for( ;index<BUTTONMAX-1 ;index++)
    {
        m_CtrlIR[ index ].m_text.Format( "%d",index );
        m_CtrlIR[ index ].SubclassDlgItem( IDC_BTN_N2+index,this );
    }
    m_CtrlIR[ 19 ].m_text.Format( "%s","S" );
    m_CtrlIR[ 19 ].SubclassDlgItem( IDC_BTN_N2+19,this );
    m_CtrlIR[ 19 ].m_cNormalColor = RGB(209,175,243) ;
    
    //时钟设置
    SetTimer(1,300,NULL);

    return TRUE;  // return TRUE  unless you set the focus to a control
}

void CDlgDlg::OnSysCommand(UINT nID, LPARAM lParam)
{
    if ((nID & 0xFFF0) == IDM_ABOUTBOX)
    {
        CAboutDlg dlgAbout;
        dlgAbout.DoModal();
    }
    else
    {
        CDialog::OnSysCommand(nID, lParam);
    }
}

// If you add a minimize button to your dialog, you will need the code below
//  to draw the icon.  For MFC applications using the document/view model,
//  this is automatically done for you by the framework.
/****************************************************
*               对话框绘制
*
****************************************************/
void CDlgDlg::OnPaint() 
{
    if (IsIconic())
    {
        CPaintDC dc(this); // device context for painting

        SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);

        // Center icon in client rectangle
        int cxIcon = GetSystemMetrics(SM_CXICON);
        int cyIcon = GetSystemMetrics(SM_CYICON);
        CRect rect;
        GetClientRect(&rect);
        int x = (rect.Width() - cxIcon + 1) / 2;
        int y = (rect.Height() - cyIcon + 1) / 2;

        // Draw the icon
        dc.DrawIcon(x, y, m_hIcon);
    }
    else
    {
        CPaintDC dc(this);
        CRect rect;
        GetClientRect( &rect );                  //获取对话框尺寸
        rect = CRect(rect.left+10,rect.top+5,rect.right-10,rect.top+120);

        CBrush brush;
        brush.CreateSolidBrush( RGB(0,0,0)  ); 
        dc.FillRect( rect,&brush );              //绘制背景区域属性
        dc.DrawEdge( rect,EDGE_SUNKEN,BF_RECT );
    
        CFont font;
        font.CreatePointFont( 350,"幼圆",NULL);
        dc.SelectObject( &font );
        dc.SetBkMode(TRANSPARENT);
        dc.SetTextColor( RGB(0,255,0) );         //显示主题
        dc.TextOutA( rect.left+100,rect.top+30,"简 易 数 码 分 析 器");

        CDialog::OnPaint();
    }
}

// The system calls this to obtain the cursor to display while the user drags
//  the minimized window.
HCURSOR CDlgDlg::OnQueryDragIcon()
{
    return (HCURSOR) m_hIcon;
}
// 对话框 事件映射表
BEGIN_EVENTSINK_MAP(CDlgDlg, CDialog)
    //{{AFX_EVENTSINK_MAP(CDlgDlg)
    ON_EVENT(CDlgDlg, IDC_MSCOMM1, 1 /* OnComm */, OnOnCommMscomm1, VTS_NONE)
    //}}AFX_EVENTSINK_MAP
END_EVENTSINK_MAP()

//定时器
//用定时更新将要显示的波形数据,复位控制台各按钮
void CDlgDlg::OnTimer(UINT_PTR nIDEvent)
{
    m_puShow.SetUndeeData( m_aXDlg,m_aYDlg,m_AxisCenter );     //将要显示的数据加入波形显示对象中

    //复位控制台按钮
    int index = 0;
    for( ;index < BUTTONMAX ; index++ )
    {
        m_CtrlIR[ index ].m_nFlag = 0;    //按下恢复
        m_CtrlIR[ index ].RedrawWindow(); //重绘按钮
    }

    CDialog::OnTimer(nIDEvent);
}


但是编译出现:

C:\Users\Administrator\Desktop\COM\COMM-42\dlgDlg.cpp(129) : error C2059: syntax error : '&&'
C:\Users\Administrator\Desktop\COM\COMM-42\dlgDlg.cpp(129) : error C2143: syntax error : missing ';' before '}'
C:\Users\Administrator\Desktop\COM\COMM-42\dlgDlg.cpp(129) : error C2143: syntax error : missing ';' before '}'
C:\Users\Administrator\Desktop\COM\COMM-42\dlgDlg.cpp(130) : error C2143: syntax error : missing ';' before '{'
C:\Users\Administrator\Desktop\COM\COMM-42\dlgDlg.cpp(130) : error C2447: missing function header (old-style formal list?)
C:\Users\Administrator\Desktop\COM\COMM-42\dlgDlg.cpp(130) : error C2143: syntax error : missing ';' before ','
C:\Users\Administrator\Desktop\COM\COMM-42\dlgDlg.cpp(131) : error C2143: syntax error : missing ';' before '{'
C:\Users\Administrator\Desktop\COM\COMM-42\dlgDlg.cpp(131) : error C2447: missing function header (old-style formal list?)
C:\Users\Administrator\Desktop\COM\COMM-42\dlgDlg.cpp(131) : error C2143: syntax error : missing ';' before ','
C:\Users\Administrator\Desktop\COM\COMM-42\dlgDlg.cpp(132) : error C2143: syntax error : missing ';' before '{'
C:\Users\Administrator\Desktop\COM\COMM-42\dlgDlg.cpp(132) : error C2447: missing function header (old-style formal list?)
C:\Users\Administrator\Desktop\COM\COMM-42\dlgDlg.cpp(132) : error C2143: syntax error : missing ';' before ','
C:\Users\Administrator\Desktop\COM\COMM-42\dlgDlg.cpp(133) : error C2143: syntax error : missing ';' before '{'
C:\Users\Administrator\Desktop\COM\COMM-42\dlgDlg.cpp(133) : error C2447: missing function header (old-style formal list?)
C:\Users\Administrator\Desktop\COM\COMM-42\dlgDlg.cpp(133) : error C2143: syntax error : missing ';' before ','
C:\Users\Administrator\Desktop\COM\COMM-42\dlgDlg.cpp(134) : error C2143: syntax error : missing ';' before '{'
C:\Users\Administrator\Desktop\COM\COMM-42\dlgDlg.cpp(134) : error C2447: missing function header (old-style formal list?)
C:\Users\Administrator\Desktop\COM\COMM-42\dlgDlg.cpp(134) : error C2143: syntax error : missing ';' before ','
C:\Users\Administrator\Desktop\COM\COMM-42\dlgDlg.cpp(135) : error C2143: syntax error : missing ';' before '{'
C:\Users\Administrator\Desktop\COM\COMM-42\dlgDlg.cpp(135) : error C2447: missing function header (old-style formal list?)
C:\Users\Administrator\Desktop\COM\COMM-42\dlgDlg.cpp(135) : error C2143: syntax error : missing ';' before ','
C:\Users\Administrator\Desktop\COM\COMM-42\dlgDlg.cpp(136) : error C2143: syntax error : missing ';' before '{'
C:\Users\Administrator\Desktop\COM\COMM-42\dlgDlg.cpp(136) : error C2447: missing function header (old-style formal list?)
C:\Users\Administrator\Desktop\COM\COMM-42\dlgDlg.cpp(136) : error C2143: syntax error : missing ';' before ','
C:\Users\Administrator\Desktop\COM\COMM-42\dlgDlg.cpp(137) : error C2143: syntax error : missing ';' before '{'
C:\Users\Administrator\Desktop\COM\COMM-42\dlgDlg.cpp(137) : error C2447: missing function header (old-style formal list?)
C:\Users\Administrator\Desktop\COM\COMM-42\dlgDlg.cpp(137) : error C2143: syntax error : missing ';' before ','
C:\Users\Administrator\Desktop\COM\COMM-42\dlgDlg.cpp(138) : error C2143: syntax error : missing ';' before '{'
C:\Users\Administrator\Desktop\COM\COMM-42\dlgDlg.cpp(138) : error C2447: missing function header (old-style formal list?)
C:\Users\Administrator\Desktop\COM\COMM-42\dlgDlg.cpp(138) : error C2143: syntax error : missing ';' before ','
C:\Users\Administrator\Desktop\COM\COMM-42\dlgDlg.cpp(139) : error C2143: syntax error : missing ';' before '{'
C:\Users\Administrator\Desktop\COM\COMM-42\dlgDlg.cpp(139) : error C2447: missing function header (old-style formal list?)
C:\Users\Administrator\Desktop\COM\COMM-42\dlgDlg.cpp(139) : error C2143: syntax error : missing ';' before '}'

请问是什么原因啊?怎样解决?
搜索更多相关主题的帖子: before color 
2013-08-07 22:21
快速回复:error C2143: syntax error : missing ';' before '}'
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.032500 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved