| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1145 人关注过本帖
标题:QT程序出错,三天找不到原因,被老板批了
只看楼主 加入收藏
flyingucla
Rank: 1
等 级:新手上路
帖 子:14
专家分:0
注 册:2012-4-2
结帖率:50%
收藏
 问题点数:0 回复次数:2 
QT程序出错,三天找不到原因,被老板批了
头文件
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
#include <QtGui>
//#include <QPalette>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
//#include <sys/ioctl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
//#include <sys/select.h>
#include <sys/time.h>
#include <errno.h>
namespace Ui {
class MainWindow;
}
class MainWindow : public QMainWindow
{
    Q_OBJECT   
public:
    explicit MainWindow(QWidget *parent = 0);
    ~MainWindow()  
private:
    Ui::MainWindow *ui;
};
#endif // MAINWINDOW_H
源文件
#include "mainwindow.h"
#include "ui_mainwindow.h"
int buttons_fd;
char buttons[4] = {'0', '0', '0', '0'};
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    buttons_fd = open("/dev/buttons", 0);
    if (buttons_fd < 0) {
    perror("open device buttons");
    exit(1);
    }
    for (;;) {
    char current_buttons[6];
    int count_of_changed_key;
    int i;
    if (read(buttons_fd, current_buttons, sizeof current_buttons) != sizeof current_buttons)
    {
    perror("read buttons:");
    exit(1);
    }
    for (i = 0, count_of_changed_key = 0; i < sizeof buttons / sizeof buttons[0]; i++) {
    if (buttons != current_buttons) {
    buttons = current_buttons;


    count_of_changed_key++;
    }
    }
    if (count_of_changed_key) {
    printf("\n");
    }
    }
}
MainWindow::~MainWindow()
{
    delete ui;
}
运行时出现错误为1:permission denied  
2:collect2:1d returned 1 exit status
搜索更多相关主题的帖子: 老板 原因 include public parent 
2012-07-13 11:18
粉红木耳
Rank: 1
等 级:新手上路
帖 子:3
专家分:2
注 册:2012-8-5
收藏
得分:0 
哈哈 我是菜鸟, 你等老鸟吧!
2012-08-05 10:45
qsy101
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2012-3-23
收藏
得分:0 
“permission denied  
1.你运行了相同的程序,但是没有关闭
2.没有修改属性为可读
2012-11-19 11:00
快速回复:QT程序出错,三天找不到原因,被老板批了
数据加载中...
 
   



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

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