Go back to Richel Bilderbeek's homepage.

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

 

 

 

 

 

(C++) WtQt CreatorUbuntu undefined reference to 'Wt::WRun(int, char**, Wt::WApplication* (*)(Wt::WEnvironment const&))'

 

Link error

 

 

 

 

 

 

Full error message

 

/MyFolder/main.o:: In function 'main':
/MyFolder/main.cpp:16: error: undefined reference to 'Wt::WRun(int, char**, Wt::WApplication* (*)(Wt::WEnvironment const&))'

 

 

 

 

 

Technical facts

 

Application type(s)

Operating system(s) or programming environment(s)

IDE(s):

Project type:

Compiler(s):

Libraries used:

 

 

 

 

 

Qt project file: CppLinkErrorUndefinedReferenceToWtWrun.pro

 

#-------------------------------------------------
#
# Project created by QtCreator 2010-12-29T17:23:02
#
#-------------------------------------------------
QT       += core
QT       -= gui
TARGET = CppLinkErrorUndefinedReferenceToWtWrun
CONFIG   += console
CONFIG   -= app_bundle
TEMPLATE = app
SOURCES += main.cpp

 

 

 

 

 

main.cpp

 

//---------------------------------------------------------------------------
#include <Wt/WApplication>
//---------------------------------------------------------------------------
struct MyWtClass : public Wt::WApplication
{
  MyWtClass(const Wt::WEnvironment& env)
    : Wt::WApplication(env) {}
};
//---------------------------------------------------------------------------
Wt::WApplication * createApplication(const Wt::WEnvironment& env)
{
  return new MyWtClass(env);
}
//---------------------------------------------------------------------------
int main(int argc, char **argv)
{
  return Wt::WRun(argc, argv, &createApplication);
}
//---------------------------------------------------------------------------

 

 

 

 

 

Solution

 

Add the following line to your Qt project file:

 

LIBS += -lwt -lwthttp

 

 

Note that the fixed version results in the misc error stat: No such file or directory. Document root ("") not valid.

 

 

 

 

 

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

Go back to Richel Bilderbeek's homepage.

 

Valid XHTML 1.0 Strict