标题:自己编的qprocess例子 各位看一下错在哪里了
作者:liuyang
日期:2006-06-06 21:14
内容:
//main.cpp
#include
#include
#include
#include "slot.h"
intmain( int argc, char **argv )
{
QApplication a( argc, argv );
QPushButton quit( "mp3play", 0 );
quit.resize( 175, 130 );
quit.setFont( QFont( "Times", 18, QFont::Bold ) );
MP3play b;
b.addArgument("sh");
b.addArgument("/1");
QObject::connect( &quit, SIGNAL(clicked()), &b, SLOT(mySlot()) );
a.setMainWidget( &quit );
quit.show();
return a.exec();
}
//slot.h
#include
class MP3play : QProcess
{
Q_OBJECT;
public:
MP3play();
public slots:
void myslot();
signals:
};
//slot.c
#include
#include
#include "slot.h"
void MP3play::myslot()
{
start();
}
//error
# make
g++ -c -pipe -Wall -W -O2 -march=i386 -mcpu=i686 -g -DGLX_GLXEXT_LEGACY -fno-use-cxa-atexit -fno-exceptions-DQT_NO_DEBUG -I/usr/lib/qt-3.1/mkspecs/default -I. -I. -I/usr/lib/qt-3.1/include -o qt.o qt.cpp
qt.cpp: In function `int main(int, char**)':
qt.cpp:15: `QObject' is an inaccessible base of `MP3play'
make: *** Error 1
#1 [shiroki 06-07 16:41]
class MP3play : QProcess
是不是因为这里没有写public阿
class MP3play : public QProcess