Project

General

Profile

Linker error undefined reference to `Wt::WRun on Ubuntu 9.10

Added by Kui Tang about 15 years ago

I am trying to compile the Hello World demo. The includes are:

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

And the compilation command is g++ -lwt hello.cpp. Boost and Wt libraries and headers are installed. However, g reports:

/tmp/cc3PFK5I.o: In function `main':
hello.cpp:(.text+0x93b): undefined reference to `Wt::WRun(int, char**, Wt::WApplication* (*)(Wt::WEnvironment const&))'
collect2: ld returned 1 exit status

I am new to C and do not understand this linker error. Could anybody explain what's going on and what I'm doing wrong?

hello.cpp (1.23 KB) hello.cpp

Replies (3)

RE: Linker error undefined reference to `Wt::WRun on Ubuntu 9.10 - Added by Wim Dumon about 15 years ago

Hello Kui,

You need to specify a connector (either -lwthttp for built-in httpd or -lwtfcgi for fcgi connector).

See also

http://redmine.emweb.be/wiki/wt/Frequently_Asked_Questions#Q-How-do-I-build-my-newly-written-Hello-World-application

Best regards,

Wim.

RE: Linker error undefined reference to `Wt::WRun on Ubuntu 9.10 - Added by Richel Bilderbeek about 14 years ago

Although I am familiar with this linker error, I am puzzled by the following: after upgrading Wt from version 3.1.2 to 3.1.9, this error pops up in all my Wt programs, although I (still) linked all Wt libraries correctly. Also linking to all libraries (wt, wthttp, wtdbo, dbosqlite3, wtfcgi, wtext and wtdbopostgres) did not solve the problem.

What do I miss?

Thanks in advance, Bilderbikkel

RE: Linker error undefined reference to `Wt::WRun on Ubuntu 9.10 - Added by Richel Bilderbeek about 14 years ago

Solved this error: when re-installing the Wt libraries I forgot one step (the 'ccmake .' step). Reinstalling exactly as described at http://www.webtoolkit.eu/wt/doc/reference/html/Installation.html really really works :-)

    (1-3/3)