Support #324
Building Hello World from Gentle Intro.
| Status: | Closed | Start: | 03/04/2010 | |
|---|---|---|---|---|
| Priority: | Normal | Due date: | ||
| Assigned to: | - | % Done: | 0% |
|
| Category: | - | |||
| Target version: | - |
Description
Hi,
What is the correct way to build "Hello World" from listing 1 of:
A gentle introduction to the Wt C++ Toolkit for Web Applications.
This article is a tutorial distributed with Wt 3.1.1. The code is:
#include <WApplication>
#include <WText>
#include <WPushButton>
int wmain(int argc, char **argv)
{
WApplication appl(argc, argv);
// Widgets can be added to a parent
// by calling addWidget() ...
appl.root()->addWidget(new Wtext("<h1>Hello, World!</h1>"));
// ... or by specifying a parent at
// construction time
WPushButton *Button = new WPushButton("Quit", appl.root());
Button->clicked.connect(SLOT(&appl, Wapplication::quit));
return appl.exec();
}
I am confused by the lack of a definition for main() in the code.
A different but related question follows.
----------------------------------------
A different version of "Hello" is distributed in the examples of Wt 3.1.1.
It is hello.C. I won't include the listing, but it does include a
definition for main() (and no definition for wmain()).
I have successfully compiled this version with the command:
gcc -o hello.wthttp hello.C -I/usr/local/include -I/usr/local/include/Wt -L/usr/local/lib -lwt -lwthttp
It successfully runs on the wt-server with the command:
./hello.wthttp --docroot . --http-address 192.168.0.100 --http-port 8080
However, my compilation fails when I change -lwthttp to -lfcgi and try to compile with
gcc -o hello.fcgi hello.C -I/usr/local/include -I/usr/local/include/Wt -L/usr/local/lib -lwt -lfcgi
This is an attempt to make a FastCGI executable.
But compilation fails because Wt::WRun() is not defined in -lfgci (in otherwords libfgci.so).
This makes some sense since WRun() launches the wt-server, while FastCGI wouldn't need such a launch.
What is the correct way to compile this code for FastCGI?
Thanks.
History
Updated by Wim Dumon almost 2 years ago
- Status changed from New to Closed