Go back to Richel Bilderbeek's homepage.

Go back to Richel Bilderbeek's C++ page.

 

 

 

 

 

(C++) Wt Wt

 

Wt (we pronounce that as 'witty') is a C++ library for developing interactive web applications [1].

 

 

 

 

 

 

 

 

 

 

 

 

Qt Creator Note for Qt Creator users

 

Add the following line to your Qt project file (to prevent link errors like undefined reference to 'Wt::WRun(int, char**, Wt::WApplication* (*)(Wt::WEnvironment const&))'):

 

LIBS += -lwt -lwthttp

 

For a Wt application to run, choose one of these options:

 

  1. Use my WtAutoConfig class:

     

     

    I follow this approach in my larger programs, for example in TestGroupWidget (version 1.2).

     

  2. Change your main to the following, to call WRun with the arguments added with a C++11 initializer list:

     

    int main(int, char *argv[])
    {
      //C++11 initializer list
      const char * const v[7] =
      {
        argv[0],
        "--docroot", ".",
        "--http-port", "8080",
        "--http-address", "0.0.0.0"
      };
      return WRun(7, const_cast<char**>(v), &CreateApplication);
    }

     

    I follow this approach my very small, mostly demonstrational, programs, for example in memcheck example 6.

     

  3. Add the following arguments to the Run Settings (to prevent the misc error stat: No such file or directory. Document root ("") not valid.

     

    --docroot . --http-address 0.0.0.0 --http-port 8080

     

    Or to redirect the output to a log file (untested):

     

    --docroot . --http-address 0.0.0.0 --http-port 8080 --accesslog access.log > /dev/null 2>&1 &

     

    I never follow this approach, because I prefer my solutions in code.

     

 

 

 

 

 

External links

 

 

 

 

 

 

References

 

  1. Wt homepage

 

 

 

 

 

Go back to Richel Bilderbeek's C++ page.

Go back to Richel Bilderbeek's homepage.

 

Valid XHTML 1.0 Strict