Pergunta

I'm new in developing with Qt Creator 2.8.1 (Qt 5.1.1). To implement an application based on ftp, I searched and found that to use QFtp is necessary to install it in current Qt version. So I downloaded it from https://qt.gitorious.org/qt/qtftp/.

During the installation I met the problems below but haven't found any solutions so far. It always said "error: within this context":

leo@ubuntu:~$ cd Desktop/
leo@ubuntu:~/Desktop$ cd qt-qtftp/
leo@ubuntu:~/Desktop/qt-qtftp$ qmake
leo@ubuntu:~/Desktop/qt-qtftp$ make
cd src/ && make -f Makefile 
make[1]: Entering directory `/home/leo/Desktop/qt-qtftp/src'
cd qftp/ && make -f Makefile 
make[2]: Entering directory `/home/leo/Desktop/qt-qtftp/src/qftp'
g++ -c -pipe -O2 -Wall -W -D_REENTRANT -DQT_WEBKIT -DQT_NO_DEBUG -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/linux-g++ -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtNetwork -I/usr/include/qt4 -I. -o qftp.o qftp.cpp
In file included from qftp.cpp:45:0:
qftp.h: In member function ‘void QFtpPrivate::_q_startNextCommand()’:
qftp.h:144:10: error: ‘void QFtp::commandStarted(int)’ is protected
qftp.cpp:2201:33: error: within this context
In file included from qftp.cpp:45:0:
qftp.h:138:10: error: ‘void QFtp::stateChanged(int)’ is protected
qftp.cpp:2254:39: error: within this context
In file included from qftp.cpp:45:0:
qftp.h: In member function ‘void QFtpPrivate::_q_piFinished(const QString&)’:
qftp.h:145:10: error: ‘void QFtp::commandFinished(int, bool)’ is protected
qftp.cpp:2278:48: error: within this context
In file included from qftp.cpp:45:0:
qftp.h:146:10: error: ‘void QFtp::done(bool)’ is protected
qftp.cpp:2284:34: error: within this context
In file included from qftp.cpp:45:0:
qftp.h: In member function ‘void QFtpPrivate::_q_piError(int, const QString&)’:
qftp.h:145:10: error: ‘void QFtp::commandFinished(int, bool)’ is protected
qftp.cpp:2356:40: error: within this context
In file included from qftp.cpp:45:0:
qftp.h:146:10: error: ‘void QFtp::done(bool)’ is protected
qftp.cpp:2361:26: error: within this context
In file included from qftp.cpp:45:0:
qftp.h: In member function ‘void QFtpPrivate::_q_piConnectState(int)’:
qftp.h:138:10: error: ‘void QFtp::stateChanged(int)’ is protected
qftp.cpp:2371:38: error: within this context
In file included from qftp.cpp:45:0:
qftp.h: In member function ‘void QFtpPrivate::_q_piFtpReply(int, const QString&)’:
qftp.h:142:10: error: ‘void QFtp::rawCommandReply(int, const QString&)’ is protected
qftp.cpp:2384:50: error: within this context
make[2]: *** [qftp.o] Error 1
make[2]: Leaving directory `/home/leo/Desktop/qt-qtftp/src/qftp'
make[1]: *** [sub-qftp-make_default] Error 2
make[1]: Leaving directory `/home/leo/Desktop/qt-qtftp/src'
make: *** [sub-src-make_default] Error 2
Foi útil?

Solução

You're building against Qt 4, but this code apparently is Qt 5 only and relies on signals being public in Qt 5 (they were protected in Qt 4).

Look at the include paths set for g++:

g++ -c [...] -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtNetwork -I/usr/include/qt4 -I. -o qftp.o qftp.cpp

The Qt 4 includes of your system-wide installation are used.

I assume that's an accident and you just have to choose the correct Qt version (Qt 5.1.1) in Qt Creator.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top