Wt with Qt, .pro settings

1.7k Views Asked by At

I am trying to get Wt working with Qt. I have installed 1.47 boost library, compiled Wt (3.2.1) under Windows using cmake 2.8.8. Tired simple hello world but doesn't compile, getting undefined reference errors for example: undefined reference to `Wt::WApplication::WApplication(Wt::WEnvironment const&, Wt::WtLibVersion)'

Here is my .pro file:    
QT       -= core

QT       -= gui

INCLUDEPATH += ../../../lib/Wt/include \
          ../../../lib/boost_1_47 \
          ../../../lib/Wt/src

LIBS += -L../../../lib/Wt/lib \
    -L../../../lib/boost_1_47/lib

win32:LIBS += -lwthttpd -lwtd -lboost_regex-vc100-mt-1_47

TARGET = HttpServerWt
CONFIG   += console
CONFIG   -= app_bundle

TEMPLATE = app


SOURCES += main.cpp

This is the program I am trying to compile: http://www.webtoolkit.eu/wt/src/hello

2

There are 2 best solutions below

5
On

Probably, your WT libraries will be added to /usr/loca/lib by default. so specify link libraries accordingly[after checking whether its present there, else check in /usr/lib and include accordingly].

Set LIBS Variable as follows

LIBS += -L/usr/local/lib -lwtd -lwthttpd -lboost_regex-vc100-mt-1_47

I don't see any Problem in setting the INCLUDEPATH variable in your post.

And also make sure that you are adding the module corresponding to Wt::WApplication::WApplication(Wt::WEnvironment const&, Wt::WtLibVersion) in LIBS Variable.

For more look here.

3
On

I think you need more libraries, because in Ubuntu you need to add more than two libraries to compile a wt code with qt creator.

Here is my *.pro file

QT       += core
QT       -= gui
TARGET = prueba3
LIBS += -L/usr/lib -lwt -lwthttp -I/usr/local/include
LIBS += -L/usr/local/lib -lwthttp -lwt -lboost_regex -lboost_signals
LIBS += -lboost_system -lboost_thread -lboost_filesystem -lboost_date_time
#QMAKE_CXXFLAGS += -DNDEBUG

CONFIG   += console
CONFIG   -= app_bundle

TEMPLATE = app


SOURCES += main.cpp

and it compiles/Build great, finally you must add this line to run settings(ctrl+5)

--docroot . --http-address 0.0.0.0 --http-port 9090