Project

General

Profile

Blank Page with Hello World Projekt in Wt4

Added by Christian Meyer about 5 years ago

Please help, I have no Idea whats going on ...

This is my Program, built with Wt 4.0.3. It Compiles with -std=c++14 and Runs.

The Title is set, the Log is written, but there is no Output in the BrowserWindow.

#include <Wt/WApplication.h>
#include <Wt/WEnvironment.h>
#include <Wt/WContainerWidget.h>
#include <Wt/WText.h>


class MyApp : public Wt::WApplication
{
public:
    MyApp(const Wt::WEnvironment &env);
};

MyApp::MyApp(const Wt::WEnvironment &env)
    : Wt::WApplication(env)
{

    setTitle("What the Hell?");

    auto container = root()->addChild(std::make_unique<Wt::WContainerWidget>());

    container->addNew<Wt::WText>("A first widget");


    root()->addChild(std::make_unique<Wt::WText>("Some Text?"));

    Wt::log("notice") << "What's Going ON??????";
}

int main(int argc, char **argv)
{
    return Wt::WRun(argc, argv, [](const Wt::WEnvironment& env) {
        return std::make_unique<MyApp>(env);
      });

}

This is almost 1-1 from The Examples and Introduction. I have no Idea anymore ...

Output Program:

Starting /Code/MyApp/build/source/MyApp.wt...
[2019-Mar-14 01:29:17.402] 30441 - [info] "config: reading Wt config file: /etc/wt/wt_config.xml (location = '/Code/MyApp/build/source/MyApp.wt')"
[2019-Mar-14 01:29:17.404] 30441 - [info] "WServer/wthttp: initializing built-in wthttpd"
[2019-Mar-14 01:29:17.405] 30441 - [info] "wthttp: started server: http://0.0.0.0:9090"
[2019-Mar-14 01:29:23.531] 30441 - [info] "Wt: session created (#sessions = 1)"
[2019-Mar-14 01:29:23.532] 30441 [/ MtknHznBbXDtOWKL] [info] "WEnvironment: UserAgent: Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.36 (KHTML, like Gecko) snap Chromium/72.0.3626.121 Chrome/72.0.3626.121 Safari/537.36"
[2019-Mar-14 01:29:23.532] 30441 [/ MtknHznBbXDtOWKL] [notice] "What's Going ON??????"
[2019-Mar-14 01:29:23.533] 30441 - [info] "WebRequest: took 2.122 ms"
127.0.0.1 - - [2019-Mar-14 01:29:23.533] "GET / HTTP/1.1" 200 3088
127.0.0.1 - - [2019-Mar-14 01:29:24.220] "GET /?wtd=MtknHznBbXDtOWKL&sid=906053714&webGL=true&scrW=1920&scrH=1080&tz=60&htmlHistory=true&deployPath=%2F&request=script&rand=612632024 HTTP/1.1" 200 37165
[2019-Mar-14 01:29:24.220] 30441 - [info] "WebRequest: took 7.233 ms"
127.0.0.1 - - [2019-Mar-14 01:29:24.366] "POST /?wtd=MtknHznBbXDtOWKL HTTP/1.1" 200 49
[2019-Mar-14 01:29:24.366] 30441 - [info] "WebRequest: took 0.475 ms"
127.0.0.1 - - [2019-Mar-14 01:34:26.150] "POST /?wtd=MtknHznBbXDtOWKL HTTP/1.1" 200 49
[2019-Mar-14 01:34:26.150] 30441 - [info] "WebRequest: took 0.696 ms"

If you need any more Information, let me know.

This is really frustrating. Wanted to start using Wt4 and nothing happens...

Thank you for your Time!


Replies (2)

RE: Blank Page with Hello World Projekt in Wt4 - Added by Roel Standaert about 5 years ago

Yeah, there's a difference between addChild and addWidget. addChild only relates to ownership, not to the widget tree. addWidget both assigns ownernship and adds a widget to the widget tree, so you want to use addWidget most of the time, usually, you'll only use addChild in a few exceptional cases, like popup widgets.

RE: Blank Page with Hello World Projekt in Wt4 - Added by Christian Meyer about 5 years ago

Thank you so much!!

That really messed me up last night!

    (1-2/2)