3

I want to use ftp from my Qt project. But when I add #include <QFtp> in the program and run the compiler says: "error: QFtp: No such file or directory".

Kuba hasn't forgotten Monica
  • 95,931
  • 16
  • 151
  • 313
Ismael
  • 37
  • 1
  • 5
  • You seem not to have selected an answer, nor did you provide critics for my answer. What more can we do for you? What is missing? – László Papp Sep 28 '13 at 04:49

2 Answers2

4

You should add something like this, to your project file.

QT += network

QFtp is part of Network module

fbucek
  • 1,647
  • 13
  • 22
  • thanks but i added it before :( the problem should be anythings else!! – Ismael Sep 25 '13 at 01:38
  • 2
    What SDK do you use? I assumed that you are using Qt 4.x, because of QFtp class. But QFtp class was removed from Qt 5.x ( reason: flaw design ) – fbucek Sep 25 '13 at 05:59
3

You will need to use the qmake statement below in your qmake project file (.pro or .pri) with Qt 5 as it was moved to a separate playground module due to its design limitations. However, I have used it successfully in my previous commercial project, so it should be fine:

QT += ftp

Otherwise, if you are still using Qt 4, you just need to include the network module into the QT variables as seen below:

QT += network
László Papp
  • 51,870
  • 39
  • 111
  • 135
  • I'm using QT 5.4.2 and QT += ftp gives me a message: "Unknown module(s) in QT: ftp" – CompEng88 Jun 25 '15 at 17:58
  • @ComputerEngineer88 yeah, you should be installing the module. Of course if you don't have it installed, it doesn't exist… no reason to downvote this answer just because you have no idea how to install stuff! – The Paramagnetic Croissant Jun 26 '15 at 14:21
  • You didn't explain it well. That's good enough reason to downvote someone dontcha think? – CompEng88 Jun 26 '15 at 21:45
  • @ComputerEngineer88 um, nope? – The Paramagnetic Croissant Jun 27 '15 at 16:31
  • Sucks. Improve your answer and maybe that down vote will go away – CompEng88 Jun 28 '15 at 18:44
  • @ComputerEngineer88 "your answer"? it's not my answer. The author of the answer has been suspended so he hasn't a chance to edit it. Apply your common sense, dude. – The Paramagnetic Croissant Jun 29 '15 at 19:02
  • 1
    It's still not a good answer -- it should be down voted.... If he linked to the module and showed how to add then it would get an up vote. I don't really see what your problem is with my down vote. It's NOT a good answer or at least not good enough to stand on it's own -- the down-vote is a mechanism to get the user to give a better response or highlight other responses that could be better. – CompEng88 Jun 29 '15 at 21:42
  • @ComputerEngineer88 The up-vote is a mechanism to tease down-voters ;) – Omar Jul 01 '15 at 11:10