Mr-Ntic / qextserialport

Automatically exported from code.google.com/p/qextserialport
Other
0 stars 0 forks source link

QExtSerial will not compile under Qt5.0.0 #153

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Which version of QextSerialPort are you using?
1.2

What steps will reproduce the problem?
1.  Download and build the library using the .pro file in QtCreator 
2.6.1/Qt5.0.0.  This seems to work.
2.  In your project add the qextserial Library and include path, 
3.  In your code put in both include files and in any code add a line like: 
ports = QextSerialEnumerator::getPorts();
4.  Try to build it, fails.

What is the expected output? What do you see instead?
It should compile without issue, instead I get:
debug\moc_qextserialport.cpp(158) : error C2027: use of undefined type 
'QextSerialPortPrivate'
        c:\users\david\google drive\mpr\src\host\debug\../../../PCWin32DevelopmentTools/qextserialport-1.2rc/src/qextserialport.h(167) : see declaration of 'QextSerialPortPrivate'
debug\moc_qextserialport.cpp(158) : error C2227: left of '->_q_onWinEvent' must 
point to class/struct/union/generic type
debug\moc_qextserialport.cpp(158) : error C2061: syntax error : identifier 
'HANDLE'
debug\moc_qextserialport.cpp(159) : error C2027: use of undefined type 
'QextSerialPortPrivate'
        c:\users\david\google drive\mpr\src\host\debug\../../../PCWin32DevelopmentTools/qextserialport-1.2rc/src/qextserialport.h(167) : see declaration of 'QextSerialPortPrivate'
debug\moc_qextserialport.cpp(159) : error C2227: left of '->_q_canRead' must 
point to class/struct/union/generic type

What version of the product are you using? On what operating system?
1.2, on Windows 7, VC2010+SP1+HotFix Qt5.0.0 Released version.

Please provide any additional information below.

Original issue reported on code.google.com by R...@laxcoinc.com on 25 Dec 2012 at 6:41

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
Hi RnD,

Seems there are something wrong with you. Once the library has been compiled 
and installed to your computer through

     qmake
     nmake install

all you need is add following line to your project's file

    CONFIG += extserialport

if your are using qmake and Qt Creator.  

Or you can set the INCLUDEPATH/LIBS/DEFINES manully. 

https://code.google.com/p/qextserialport/wiki/QextSerialPort_1_2_RC#Usage(2):Sha
red_Library 
--------------------
BTW, the reason you encounter the error is that, qextserialport.h has been 
added to your project as a in-project header file. Maybe you wrongly added 
following line to your project's file

    HEADERS += $pathtoqesp/qextserialport.h

or something similiar.

Original comment by dbzhang...@gmail.com on 26 Dec 2012 at 3:34

GoogleCodeExporter commented 8 years ago
I dont understand how to install  qextserialport_1_2beta1
This is my pro file 
QT       += core gui
QT      +=serialport
CONFIG += extserialport
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = baud
TEMPLATE = app
SOURCES += main.cpp\
        mainwindow.cpp

HEADERS  += mainwindow.h
HEADERS  +=Downloads/qextserialport-1.2beta1/
FORMS    += mainwindow.ui
include(Downloads/qextserialport-1.2beta1/src/qextserialport.pri)

Error generted :
1)Downloads/qextserialport-1.2beta1/src/moc_qextserialport.cpp:14: error: 
#error "This file was generated using the moc from 4.7.4. It"
2)Downloads/qextserialport-1.2beta1/src/moc_qextserialport.cpp:15: error: 
#error "cannot be used with the include files from this version of Qt."
3)Downloads/qextserialport-1.2beta1/src/moc_qextserialport.cpp:16: error: 
#error "(The moc has changed too much.)"
4)Downloads/qextserialport-1.2beta1/src/moc_qextserialport.cpp:81: error: 
cannot convert 'const char*' to 'const QByteArrayData* {aka const QArrayData*}' 
in initialization
5)Downloads/qextserialport-1.2beta1/src/moc_qextserialport.cpp:89: error: 
conditional expression between distinct pointer types 'QDynamicMetaObjectData*' 
and 'const QMetaObject*' lacks a cast

How to solve this problem

Original comment by sushantb...@gmail.com on 20 Jul 2013 at 4:47

GoogleCodeExporter commented 8 years ago
was this problem ever solved?

Original comment by hecht.t...@gmail.com on 16 Oct 2013 at 9:21

GoogleCodeExporter commented 8 years ago
The reason are the lines :

#ifdef Q_OS_WIN
    Q_PRIVATE_SLOT(d_func(), void _q_onWinEvent(HANDLE))
#endif

in qextserialport.h

If compiled in Visual Studio, all works fine, if compiled with nmake (or jom) 
you get the errors.

As workaround, I
 - Added a precompiled header including "qextserialport.h" and "qextserialport_p.h" to the project

 - removed the line
#include "moc_qextserialport.cpp"
in qextserialport.cpp

 - removed the line
#include "moc_qextserialenumerator.cpp"
in qextserialenumerator.cpp

Original comment by narval...@gmail.com on 6 Nov 2013 at 2:28

GoogleCodeExporter commented 8 years ago

Original comment by dbzhang...@gmail.com on 9 May 2014 at 7:57