Wt Проблемы с компиляцией

Я начинаю изучать, как писать приложения Wt, но я получаю ошибку компиляции, которую я не понимаю, как исправить. При компиляции я получаю сообщение об ошибке

g++ -lwthttp -lwt hello.cpp
/usr/bin/ld: /usr/lib/gcc/i686-pc-linux-gnu/4.7.2/../../../libwt.so: undefined reference to symbol '_ZN5boost7signals6detail16signal_base_impl12connect_slotERKNS_3anyERKNS1_12stored_groupENS_10shared_ptrINS1_9slot_base6data_tEEENS0_16connect_positionE'
/usr/bin/ld: note: '_ZN5boost7signals6detail16signal_base_impl12connect_slotERKNS_3anyERKNS1_12stored_groupENS_10shared_ptrINS1_9slot_base6data_tEEENS0_16connect_positionE' is defined in DSO /usr/lib/libboost_signals.so.1.52.0 so try adding it to the linker command line
/usr/lib/libboost_signals.so.1.52.0: could not read symbols: Invalid operation
collect2: error: ld returned 1 exit status

Я использую самую последнюю версию Arch Linux, если она пригодится. Кроме того, вот приложение, которое я хочу скомпилировать.

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

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

private:
Wt::WLineEdit *nameEdit_;
Wt::WText     *greeting_;

void greet();
};

HelloApplication::HelloApplication(const Wt::WEnvironment& env) : Wt::WApplication(env) {
setTitle("Hello world");

root()->addWidget(new Wt::WText("What is your name? "));
nameEdit_ = new Wt::WLineEdit(root());
Wt::WPushButton *button = new Wt::WPushButton("Greet me.", root());
root()->addWidget(new Wt::WBreak());
greeting_ = new Wt::WText(root());
button->clicked().connect(this, &HelloApplication::greet);
}

void HelloApplication::greet() {
greeting_->setText("Hello there, " + nameEdit_->text());
}

Wt::WApplication *createApplication(const Wt::WEnvironment& env) {
return new HelloApplication(env);
}

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

ОБНОВЛЕННАЯ ИНФОРМАЦИЯ:
Если я свяжу библиотеку libboost_signals, то получу следующий вывод консоли.

    g++ hello.cpp -lwt -lwthttp -lboost_signals

/usr/bin/ld: warning: libGraphicsMagick.so.3, needed by /usr/lib/gcc/i686-pc-linux-gnu/4.7.2/../../../libwt.so, not found (try using -rpath or -rpath-link)
/usr/lib/gcc/i686-pc-linux-gnu/4.7.2/../../../libwt.so: undefined reference to `DrawPathCurveToQuadraticBezierAbsolute'
/usr/lib/gcc/i686-pc-linux-gnu/4.7.2/../../../libwt.so: undefined reference to `DrawSetStrokeWidth'
/usr/lib/gcc/i686-pc-linux-gnu/4.7.2/../../../libwt.so: undefined reference to `DrawSetClipUnits'
/usr/lib/gcc/i686-pc-linux-gnu/4.7.2/../../../libwt.so: undefined reference to `SetImageType'
/usr/lib/gcc/i686-pc-linux-gnu/4.7.2/../../../libwt.so: undefined reference to `DrawSetStrokeColor'
/usr/lib/gcc/i686-pc-linux-gnu/4.7.2/../../../libwt.so: undefined reference to `GetDrawInfo'
/usr/lib/gcc/i686-pc-linux-gnu/4.7.2/../../../libwt.so: undefined reference to `DrawDestroyContext'
/usr/lib/gcc/i686-pc-linux-gnu/4.7.2/../../../libwt.so: undefined reference to `DrawPathLineToAbsolute'
/usr/lib/gcc/i686-pc-linux-gnu/4.7.2/../../../libwt.so: undefined reference to `DrawAnnotation'
/usr/lib/gcc/i686-pc-linux-gnu/4.7.2/../../../libwt.so: undefined reference to `ReadInlineImage'
/usr/lib/gcc/i686-pc-linux-gnu/4.7.2/../../../libwt.so: undefined reference to `DrawPathStart'
/usr/lib/gcc/i686-pc-linux-gnu/4.7.2/../../../libwt.so: undefined reference to `DrawSetClipPath'
/usr/lib/gcc/i686-pc-linux-gnu/4.7.2/../../../libwt.so: undefined reference to `SetImagePixels'
/usr/lib/gcc/i686-pc-linux-gnu/4.7.2/../../../libwt.so: undefined reference to `DrawSetStrokeOpacity'
/usr/lib/gcc/i686-pc-linux-gnu/4.7.2/../../../libwt.so: undefined reference to `DrawPopClipPath'
/usr/lib/gcc/i686-pc-linux-gnu/4.7.2/../../../libwt.so: undefined reference to `DrawSetFillOpacity'
/usr/lib/gcc/i686-pc-linux-gnu/4.7.2/../../../libwt.so: undefined reference to `DrawSetStrokeAntialias'
/usr/lib/gcc/i686-pc-linux-gnu/4.7.2/../../../libwt.so: undefined reference to `DrawPopGraphicContext'
/usr/lib/gcc/i686-pc-linux-gnu/4.7.2/../../../libwt.so: undefined reference to `SyncImagePixels'
/usr/lib/gcc/i686-pc-linux-gnu/4.7.2/../../../libwt.so: undefined reference to `DestroyImage'
/usr/lib/gcc/i686-pc-linux-gnu/4.7.2/../../../libwt.so: undefined reference to `DrawPushGraphicContext'
/usr/lib/gcc/i686-pc-linux-gnu/4.7.2/../../../libwt.so: undefined reference to `DrawLine'
/usr/lib/gcc/i686-pc-linux-gnu/4.7.2/../../../libwt.so: undefined reference to `DrawRender'
/usr/lib/gcc/i686-pc-linux-gnu/4.7.2/../../../libwt.so: undefined reference to `DestroyMagick'
/usr/lib/gcc/i686-pc-linux-gnu/4.7.2/../../../libwt.so: undefined reference to `DrawPathCurveToAbsolute'
/usr/lib/gcc/i686-pc-linux-gnu/4.7.2/../../../libwt.so: undefined reference to `ConstituteImage'
/usr/lib/gcc/i686-pc-linux-gnu/4.7.2/../../../libwt.so: undefined reference to `DrawSetFontSize'
/usr/lib/gcc/i686-pc-linux-gnu/4.7.2/../../../libwt.so: undefined reference to `GetExceptionInfo'
/usr/lib/gcc/i686-pc-linux-gnu/4.7.2/../../../libwt.so: undefined reference to `GetImagePixels'
/usr/lib/gcc/i686-pc-linux-gnu/4.7.2/../../../libwt.so: undefined reference to `DrawSetStrokeDashArray'
/usr/lib/gcc/i686-pc-linux-gnu/4.7.2/../../../libwt.so: undefined reference to `ImageToBlob'
/usr/lib/gcc/i686-pc-linux-gnu/4.7.2/../../../libwt.so: undefined reference to `ReadImage'
/usr/lib/gcc/i686-pc-linux-gnu/4.7.2/../../../libwt.so: undefined reference to `SetImageOpacity'
/usr/lib/gcc/i686-pc-linux-gnu/4.7.2/../../../libwt.so: undefined reference to `DrawPathMoveToAbsolute'
/usr/lib/gcc/i686-pc-linux-gnu/4.7.2/../../../libwt.so: undefined reference to `DrawPushClipPath'
/usr/lib/gcc/i686-pc-linux-gnu/4.7.2/../../../libwt.so: undefined reference to `CropImage'
/usr/lib/gcc/i686-pc-linux-gnu/4.7.2/../../../libwt.so: undefined reference to `DrawSetFillRule'
/usr/lib/gcc/i686-pc-linux-gnu/4.7.2/../../../libwt.so: undefined reference to `DrawPathFinish'
/usr/lib/gcc/i686-pc-linux-gnu/4.7.2/../../../libwt.so: undefined reference to `GetImageInfo'
/usr/lib/gcc/i686-pc-linux-gnu/4.7.2/../../../libwt.so: undefined reference to `DrawSetFillColor'
/usr/lib/gcc/i686-pc-linux-gnu/4.7.2/../../../libwt.so: undefined reference to `DrawSetFont'
/usr/lib/gcc/i686-pc-linux-gnu/4.7.2/../../../libwt.so: undefined reference to `DrawArc'
/usr/lib/gcc/i686-pc-linux-gnu/4.7.2/../../../libwt.so: undefined reference to `DrawAffine'
/usr/lib/gcc/i686-pc-linux-gnu/4.7.2/../../../libwt.so: undefined reference to `DestroyDrawInfo'
/usr/lib/gcc/i686-pc-linux-gnu/4.7.2/../../../libwt.so: undefined reference to `DrawClipPath'
/usr/lib/gcc/i686-pc-linux-gnu/4.7.2/../../../libwt.so: undefined reference to `DrawSetTextEncoding'
/usr/lib/gcc/i686-pc-linux-gnu/4.7.2/../../../libwt.so: undefined reference to `SetImageClipMask'
/usr/lib/gcc/i686-pc-linux-gnu/4.7.2/../../../libwt.so: undefined reference to `DrawComposite'
/usr/lib/gcc/i686-pc-linux-gnu/4.7.2/../../../libwt.so: undefined reference to `DrawPathEllipticArcAbsolute'
/usr/lib/gcc/i686-pc-linux-gnu/4.7.2/../../../libwt.so: undefined reference to `DrawAllocateContext'
/usr/lib/gcc/i686-pc-linux-gnu/4.7.2/../../../libwt.so: undefined reference to `DrawSetStrokeLineCap'
/usr/lib/gcc/i686-pc-linux-gnu/4.7.2/../../../libwt.so: undefined reference to `InitializeMagick'
/usr/lib/gcc/i686-pc-linux-gnu/4.7.2/../../../libwt.so: undefined reference to `DrawSetGravity'
/usr/lib/gcc/i686-pc-linux-gnu/4.7.2/../../../libwt.so: undefined reference to `CompositeImage'
collect2: error: ld returned 1 exit status

0

Решение

Оказывается, в AUR перечислены некоторые необязательные зависимости, которые необходимы для правильной компиляции. Они перечислены здесь

https://www.archlinux.org/packages/community/i686/wt/

Кроме того, при следовании учебник найден здесь

http://www.webtoolkit.eu/wt/src/hello

Вы должны включить

-lboost_signals

флаг во время компиляции.

1

Другие решения

Подсказка в сообщении об ошибке, вам нужно установить libgraphicsmagick.

Все неопределенные ссылки находятся в этой библиотеке.

Вот вывод ldd из успешно связанной программы. я использовал -lwthttp -lwt -lboost_signals

    linux-gate.so.1 =>  (0xb770f000)
libwthttp.so.32 => /usr/lib/libwthttp.so.32 (0xb7629000)
libwt.so.32 => /usr/lib/libwt.so.32 (0xb6fe3000)
libboost_signals.so.1.49.0 => /usr/lib/libboost_signals.so.1.49.0 (0xb6fce000)
libstdc++.so.6 => /usr/lib/i386-linux-gnu/libstdc++.so.6 (0xb6ee2000)
libm.so.6 => /lib/i386-linux-gnu/i686/cmov/libm.so.6 (0xb6ebc000)
libgcc_s.so.1 => /lib/i386-linux-gnu/libgcc_s.so.1 (0xb6e9f000)
libc.so.6 => /lib/i386-linux-gnu/i686/cmov/libc.so.6 (0xb6d3c000)
libz.so.1 => /lib/i386-linux-gnu/libz.so.1 (0xb6d22000)
libssl.so.1.0.0 => /usr/lib/i386-linux-gnu/i686/cmov/libssl.so.1.0.0 (0xb6cca000)
libcrypto.so.1.0.0 => /usr/lib/i386-linux-gnu/i686/cmov/libcrypto.so.1.0.0 (0xb6b0b000)
libboost_program_options.so.1.49.0 => /usr/lib/libboost_program_options.so.1.49.0 (0xb6aaf000)
libpthread.so.0 => /lib/i386-linux-gnu/i686/cmov/libpthread.so.0 (0xb6a96000)
libboost_system.so.1.49.0 => /usr/lib/libboost_system.so.1.49.0 (0xb6a91000)
libboost_thread.so.1.49.0 => /usr/lib/libboost_thread.so.1.49.0 (0xb6a78000)
libboost_regex.so.1.49.0 => /usr/lib/libboost_regex.so.1.49.0 (0xb6968000)
libboost_date_time.so.1.49.0 => /usr/lib/libboost_date_time.so.1.49.0 (0xb6959000)
libboost_filesystem.so.1.49.0 => /usr/lib/libboost_filesystem.so.1.49.0 (0xb693a000)
libhpdf-2.2.1.so => /usr/lib/libhpdf-2.2.1.so (0xb6887000)
libGraphicsMagick.so.3 => /usr/lib/libGraphicsMagick.so.3 (0xb6560000)
libpangoft2-1.0.so.0 => /usr/lib/i386-linux-gnu/libpangoft2-1.0.so.0 (0xb6532000)
libpango-1.0.so.0 => /usr/lib/i386-linux-gnu/libpango-1.0.so.0 (0xb64e6000)
libgobject-2.0.so.0 => /usr/lib/i386-linux-gnu/libgobject-2.0.so.0 (0xb6494000)
libglib-2.0.so.0 => /lib/i386-linux-gnu/libglib-2.0.so.0 (0xb6396000)
librt.so.1 => /lib/i386-linux-gnu/i686/cmov/librt.so.1 (0xb638d000)
/lib/ld-linux.so.2 (0xb7710000)
libdl.so.2 => /lib/i386-linux-gnu/i686/cmov/libdl.so.2 (0xb6389000)
libicuuc.so.48 => /usr/lib/i386-linux-gnu/libicuuc.so.48 (0xb621f000)
libicui18n.so.48 => /usr/lib/i386-linux-gnu/libicui18n.so.48 (0xb6044000)
libicudata.so.48 => /usr/lib/i386-linux-gnu/libicudata.so.48 (0xb4ed3000)
libpng12.so.0 => /lib/i386-linux-gnu/libpng12.so.0 (0xb4ea9000)
libjbig.so.0 => /usr/lib/i386-linux-gnu/libjbig.so.0 (0xb4e9b000)
liblcms.so.1 => /usr/lib/i386-linux-gnu/liblcms.so.1 (0xb4e60000)
libtiff.so.4 => /usr/lib/i386-linux-gnu/libtiff.so.4 (0xb4df9000)
libfreetype.so.6 => /usr/lib/i386-linux-gnu/libfreetype.so.6 (0xb4d5d000)
libjasper.so.1 => /usr/lib/i386-linux-gnu/libjasper.so.1 (0xb4d06000)
libjpeg.so.8 => /usr/lib/i386-linux-gnu/libjpeg.so.8 (0xb4ccd000)
libwmflite-0.2.so.7 => /usr/lib/i386-linux-gnu/libwmflite-0.2.so.7 (0xb4caf000)
libXext.so.6 => /usr/lib/i386-linux-gnu/libXext.so.6 (0xb4c9c000)
libSM.so.6 => /usr/lib/i386-linux-gnu/libSM.so.6 (0xb4c94000)
libICE.so.6 => /usr/lib/i386-linux-gnu/libICE.so.6 (0xb4c7b000)
libX11.so.6 => /usr/lib/i386-linux-gnu/libX11.so.6 (0xb4b43000)
libbz2.so.1.0 => /lib/i386-linux-gnu/libbz2.so.1.0 (0xb4b32000)
libxml2.so.2 => /usr/lib/i386-linux-gnu/libxml2.so.2 (0xb49de000)
libgomp.so.1 => /usr/lib/i386-linux-gnu/libgomp.so.1 (0xb49ce000)
libltdl.so.7 => /usr/lib/i386-linux-gnu/libltdl.so.7 (0xb49c4000)
libgmodule-2.0.so.0 => /usr/lib/i386-linux-gnu/libgmodule-2.0.so.0 (0xb49bf000)
libfontconfig.so.1 => /usr/lib/i386-linux-gnu/libfontconfig.so.1 (0xb4989000)
libgthread-2.0.so.0 => /usr/lib/i386-linux-gnu/libgthread-2.0.so.0 (0xb4985000)
libffi.so.5 => /usr/lib/i386-linux-gnu/libffi.so.5 (0xb497c000)
libpcre.so.3 => /lib/i386-linux-gnu/libpcre.so.3 (0xb493e000)
libuuid.so.1 => /lib/i386-linux-gnu/libuuid.so.1 (0xb4938000)
libxcb.so.1 => /usr/lib/i386-linux-gnu/libxcb.so.1 (0xb4914000)
liblzma.so.5 => /lib/i386-linux-gnu/liblzma.so.5 (0xb48ed000)
libexpat.so.1 => /lib/i386-linux-gnu/libexpat.so.1 (0xb48c3000)
libXau.so.6 => /usr/lib/i386-linux-gnu/libXau.so.6 (0xb48c0000)
libXdmcp.so.6 => /usr/lib/i386-linux-gnu/libXdmcp.so.6 (0xb48ba000)
1

По вопросам рекламы [email protected]