[Solved]Qt and FreeBSD

  • Good day, every one!
    I'm trying to install and use Qt on FreeBSD without any windows system, only command line.
    I've installed Qt, and when I'm trying to build small test application (hello world), and I'm getting nothing but errors.
    I'm not going to tell you about erros I've got, I just want to know, is it really possible to use Qt without any GUI?
    I want to build some command line applications.

    Thanks you all!

  • Moderators

    Yes, it's absolutely possible.

    While I can't imagine why you'd want to withhold the errors you're getting (because nobody likes trying to read your mind and make wild guesses as what's wrong) I'll throw out a couple of things.

    Make sure you're using QCoreApplication instead of QApplication, and in your .pro file, make sure you have the line
    QT -= gui

    Anything else, and you're on your own unless you care to share more.

  • Moderators

    It is possible, but by default a qmake based project will include QtGui.

    Try adding @QT -= gui@ to your .pro file.

  • Good morning!

    bq. While I can’t imagine why you’d want to withhold the errors you’re getting (because nobody likes trying to read your mind and make wild guesses as what’s wrong)

    mlong, I'm really sorry for that. I'm a newcomer in Qt and I'm a newcomer FreeBSD, in other words - I'm a totaly newcomer. There is a lot errors I've got, so first I thought "May be it is impossible".

  • Moderators

    No worries. Don't worry about being a newcomer. There are people of all skill levels around here, all of whom have been beginners at one point or another. Don't be afraid to give any pertinent information when you have a problem!

    I hope the above suggestions helped in getting a command line app running. If not, check back in and we'll make sure you get the help you need!

    Have fun, and welcome!

  • Moderators

    I just made a test project in QT Creator, so you can test your installation.


    @QT += core
    QT -= gui

    TARGET = testConsole
    CONFIG += console
    CONFIG -= app_bundle

    TEMPLATE = app
    SOURCES += main.cpp@

    @#include <QtCore/QCoreApplication>

    int main(int argc, char *argv[])
    QCoreApplication a(argc, argv);

    return a.exec&#40;&#41;;


    Put these files in a directory named testConsole
    Open that directory in your console.

    then do

  • Wow!!! Thank you so much!!! Now it is work!!!
    Eddy, thank you for your exmaple, but I use qmake-qt4 instead of qmake
    , because when I type
    @qmake -v@
    it shows me
    @...version 3.xxx@

  • Moderators

    You're welcome.

    I don't know how to set environment variables in freebsd to change the path variable, but your solution is fine too. ;)

    Have fun with Qt!

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.