Project

General

Profile

Linker error undefined reference to `Wt::WRun on Ubuntu 9.10 ยป hello.cpp

Kui Tang, 02/24/2010 12:51 AM

 
#include <Wt/WApplication>
#include <Wt/WBreak>
#include <Wt/WContainerWidget>
#include <Wt/WLineEdit>
#include <Wt/WPushButton>
#include <Wt/WText>

using namespace Wt;

class HelloApp : public WApplication {
public:
HelloApp(const WEnvironment& env);

private:
WLineEdit *nameEdit_;
WText *greeting_;

void greet();
};

HelloApp::HelloApp(const WEnvironment& env) : WApplication(env) {
setTitle("Hello World");

root()->addWidget(new WText("Your name, please? "));
// show text
nameEdit_ = new WLineEdit(root());
nameEdit_->setFocus();

WPushButton *b = new WPushButton("Greet me.", root());
b->setMargin(5, WWidget::Left);

root()->addWidget(new WBreak()); // empty link break

greeting_ = new WText(root()); // empty text

// Connect signals with slots

b->clicked.connect(SLOT(this, HelloApp::greet));
nameEdit_->enterPressed.connect(SLOT(this, HelloApp::greet));
}

void HelloApp::greet() {
// Update the text using input in the nameEdit_
greeting_->setText("Hello there, " + nameEdit_->text());
}

WApplication *createApplication(const WEnvironment &env) {
return new HelloApp(env);
}

int main(int argc, char **argv) {
return WRun(argc, argv, &createApplication);
}


    (1-1/1)