|
我用qt designer编了一个关于progressbar的程序,connection里的slotStart函数代码如下:
[code:1]include<sys/types.h>
#inlcude<linux/unistd.h> //这是一个关于多个进程并行的程序
#include<stdio.h>
#define MAX 100
void ThreeProcess::Slotstart()
{
int i,j,k,m;
i=j=k=m=0;
pid_t pid_1,pid_2;
pid_1=fork(); //第一次复制进程
if(pid_1<0){ //检查进程复制成功否 下同
output->setText("Error in fork 1! :( ");
exit(0);
}
pid_2=fork(); //第二次复制进程
if(pid_2<0){
output->setText("Error in fork 2! :( ");
exit(0);
} 此时已经有四个进程了不过我只需要三个
if(pid_1>0&&pid_2>0) //进程一
{
for(i=0;i<MAX;i++) //由i的值来显示进度 下同
{
progressBar1.setProgress(i); //37行 这里出错
output->setText(" "); //output为一个textEdit 显示出错信息以及
} //进程运行信息
}
if(pid_1>0&&pid_2==0) 。。进程二
{
for(j=0;j<MAX;j++)
{
progressBar2.setProgress(j); //45行 这里出错
output->setText(" ");
}
}
if(pid_1==0&&pid_2>0) //进程三
{
for(k=0;k<MAX;k++)
{
progressBar3.setProgress(k); //54行 这里出错
output->setText(" ");
}
}
if(pid_1==0&&pid_2==0) //进程四 不会显示进度 但是当它运行时会在那个
{ //名为output的textEdit上显示信息
for(m=0;m<MAX;m++)
{
output->setText("Process 4 is running !! ^ - ^ ");
}
}
}
[/code:1]
qmake以及make之后错误如下:
[code:1].ui/../threeprocess.ui.h:13:2: invalid preprocessing directive #inlcude
In file included from .ui/threeprocess.cpp:20: //这里是虾米意思??
.ui/../threeprocess.ui.h: In member function `virtual void ThreeProcess::Slotstart1()':
.ui/../threeprocess.ui.h:37: error: request for member `setProgress' in `((ThreeProcess*)this)->ThreeProcess::progressBar1', which is of non-class type `QProgressBar*'
.ui/../threeprocess.ui.h:45: error: request for member `setProgress' in `((ThreeProcess*)this)->ThreeProcess::progressBar2', which is of non-class type `QProgressBar*'
.ui/../threeprocess.ui.h:54: error: request for member `setProgress' in `((ThreeProcess*)this)->ThreeProcess::progressBar3', which is of non-class type `QProgressBar*'
make: *** [.obj/threeprocess.o] 错误 1
[/code:1]
麻烦哪位解释一下 给点提示 谢谢了 !! :)
是不是函数头文件少了或者什么的?
我刚看qt两天 明天就叫课设作业,看的东西都是跳着看的,大家体谅一下哈 |
|