Hi, I have spend 1 week try to resolve the problem but still failed. Would like to seek you guy help on below error.
I had build a simple form with feature for signal/slots. So Q_OBJECT is a must. In my header file myQtApp.h, I try to include header file "scsicmd.h" & "atacmd.h" (link to static library) it failed to compiled. Below is error message and code and project file. Hope somebody can guide me. Thanks you very much.
root@udoobuntu: /home/ubuntu/firstGUI $ qmake
root@udoobuntu: /home/ubuntu/firstGUI $ make
g++ -c -pipe -O2 -Wall -W -D_REENTRANT -DQT_WEBKIT -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mk
specs/linux-g++ -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4 -I. -I. -o myqtapp.o myqtapp.cpp
In file included from myqtapp.cpp:7:0:
myqtapp.h:20:5: error: expected nested-name-specifier before numeric constant
myqtapp.h:20:5: error: expected '>' before numeric constant
myqtapp.h:20:5: error: ISO C++ forbids declaration of 'parameter' with no type [-fpermissive]
myqtapp.h:20:5: error: expected ',' or '...' before numeric constant
myqtapp.h: In member function 'void myQtApp::qt_check_for_QOBJECT_macro(int) const':
myqtapp.h:20:5: error: '_q_argument' was not declared in this scope
myqtapp.cpp: At global scope:
myqtapp.cpp:11:1: warning: unused parameter 'parent' [-Wunused-parameter]
make: *** [myqtapp.o] Error 1
root@udoobuntu: /home/ubuntu/firstGUI $
myqtapp.h code:
#ifndef MYQTAPP_H
#define MYQTAPP_H
#include "scsicmd.h" //SCSI Command Library (static) <--- error failed to compiled
#include "atacmd.h" //ATA Command Library (static) <--- error failed to compiled
#include "ui_myqtapp.h"
#include <unistd.h>
#include <fcntl.h>
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <fstream>
#include <sys/ioctl.h>
#include <sys/types.h>
#include <scsi/sg.h>
class myQtApp
: public QWidget,
private Ui
::myQtAppDLG{
Q_OBJECT //<--- all error point to this line 20 !!!
public:
~myQtApp();
sg_io_hdr_t io_hdr; //SCSI Generic Structure
SCSICmd *SCSICommand;
ATACmd *ATACommand;
int sg_dev;
public slots:
void getPath();
void doSomething();
void clear();
void about();
void bufferdump(char *d,unsigned int);
void ByteSwapAll(unsigned char *buffer, int size);
DWORD dwordReverse (DWORD dword);
WORD wordReverse (WORD word);
void openlib();
void openDevice(int dev=0);
protected:
u_char dataBuffer[512*512];
u_char senseBuffer[64];
u_char errorBuffer[64];
DWORD tx_len;
char tmp[10];
char model[22];
char vendor[8];
char fw[8];
char serial[20];
BYTE byReadCap [8];
UINT blocksize;
UINT dwMaxLBA;
UINT capacity;
};
#endif
#ifndef MYQTAPP_H
#define MYQTAPP_H
#include "scsicmd.h" //SCSI Command Library (static) <--- error failed to compiled
#include "atacmd.h" //ATA Command Library (static) <--- error failed to compiled
#include "ui_myqtapp.h"
#include <unistd.h>
#include <fcntl.h>
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <fstream>
#include <sys/ioctl.h>
#include <sys/types.h>
#include <scsi/sg.h>
class myQtApp : public QWidget, private Ui::myQtAppDLG
{
Q_OBJECT //<--- all error point to this line 20 !!!
public:
myQtApp(QWidget *parent = 0);
~myQtApp();
sg_io_hdr_t io_hdr; //SCSI Generic Structure
SCSICmd *SCSICommand;
ATACmd *ATACommand;
int sg_dev;
public slots:
void getPath();
void doSomething();
void clear();
void about();
void bufferdump(char *d,unsigned int);
void ByteSwapAll(unsigned char *buffer, int size);
DWORD dwordReverse (DWORD dword);
WORD wordReverse (WORD word);
void openlib();
void openDevice(int dev=0);
protected:
u_char dataBuffer[512*512];
u_char senseBuffer[64];
u_char errorBuffer[64];
DWORD tx_len;
char tmp[10];
char model[22];
char vendor[8];
char fw[8];
char serial[20];
BYTE byReadCap [8];
UINT blocksize;
UINT dwMaxLBA;
UINT capacity;
};
#endif
To copy to clipboard, switch view to plain text mode
myqtapp.pro file:
HEADERS = atacmd.h scsicmd.h myqtapp.h
SOURCES = myqtapp.cpp main.cpp
FORMS = myqtapp.ui
LIBS = /usr/local/lib/libATACmd.a /usr/local/lib/libSCSICmd.a
# install
target.path = myqtapp
sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS *.pro
sources.path = .
INSTALLS += target sources
HEADERS = atacmd.h scsicmd.h myqtapp.h
SOURCES = myqtapp.cpp main.cpp
FORMS = myqtapp.ui
LIBS = /usr/local/lib/libATACmd.a /usr/local/lib/libSCSICmd.a
# install
target.path = myqtapp
sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS *.pro
sources.path = .
INSTALLS += target sources
To copy to clipboard, switch view to plain text mode
Bookmarks