Getting Started Compiler Errors
Added by Takumi Kego over 11 years ago
A pleasure to meet you all, I am just getting started with Wt (and c in general) and having issues with compiling "hello.C" from the examples folder. I currently use Debian. The command I use at terminal is,
[code]g -lwt -lwthttp hello.C -o hello_test.wt[/code]
The error I recieve is,
[code]
hello.C:7:27: fatal error: Wt/Application: No such file or directory
#include
^
compilation terminated.
[/code]
While, I do understand what the error is telling me (that it cannot include the code requested by the include because the directory doesn't exist), I have no idea exactly what I should change in my compile arguments to fix it.
Replies (10)
RE: Getting Started Compiler Errors - Added by Wim Dumon over 11 years ago
How did you install Wt on your debian computer?
Wim.
RE: Getting Started Compiler Errors - Added by Takumi Kego over 11 years ago
Used the Ubuntu suggestion (there usually is no problem between the two) from http://www.webtoolkit.eu/wt/download
@@sudo apt-get install witty witty-dev witty-doc witty-dbg witty-examples
RE: Getting Started Compiler Errors - Added by Wim Dumon over 11 years ago
That looks right, header files should be here: /usr/include/Wt/WApplication
Ah, I notice the typo in your compile error: The header file is called Wt/WApplication, not Wt/Application.
BR,
Wim.
RE: Getting Started Compiler Errors - Added by Takumi Kego over 11 years ago
Thank you for your quick and accurate responses Wim Dumon. Now that I have that issue sorted, I'm being hit with this,
In file included from /usr/include/Wt/WSignal:17:0,
bk201-deb:/usr/lib/Wt/examples/hello$
from /usr/include/Wt/WWidget:14,
from /usr/include/Wt/WWebWidget:14,
from /usr/include/Wt/WBreak:10,
from /usr/include/Wt/WCssStyleSheet:14,
from /usr/include/Wt/WApplication:26,
from hello.C:7:
/usr/include/boost/signal.hpp:17:4: warning: #warning "Boost.Signals is no longer being maintained and is now deprecated. Please switch to Boost.Signals2. To disable this warning message, define BOOST_SIGNALS_NO_DEPRECATION_WARNING." [-Wcpp]
# warning "Boost.Signals is no longer being maintained and is now deprecated. Please switch to Boost.Signals2. To disable this warning message, define BOOST_SIGNALS_NO_DEPRECATION_WARNING."
^
/usr/bin/ld: cannot open output file hello_test.wt: Permission denied
collect2: error: ld returned 1 exit status
takumi
takumi@bk201-deb:/usr/lib/Wt/examples/hello$ sudo g -lwt -lwthttp hello.C -o hello_test.wt
In file included from /usr/include/Wt/WSignal:17:0,
from /usr/include/Wt/WWidget:14,
from /usr/include/Wt/WWebWidget:14,
from /usr/include/Wt/WBreak:10,
from /usr/include/Wt/WCssStyleSheet:14,
from /usr/include/Wt/WApplication:26,
from hello.C:7:
/usr/include/boost/signal.hpp:17:4: warning: #warning "Boost.Signals is no longer being maintained and is now deprecated. Please switch to Boost.Signals2. To disable this warning message, define BOOST_SIGNALS_NO_DEPRECATION_WARNING." [-Wcpp]
# warning "Boost.Signals is no longer being maintained and is now deprecated. Please switch to Boost.Signals2. To disable this warning message, define BOOST_SIGNALS_NO_DEPRECATION_WARNING."
^
/usr/bin/ld: /usr/lib/gcc/i486-linux-gnu/4.8/../../../../lib/libwt.so: undefined reference to symbol '_ZN5boost7signals6detail9slot_base17create_connectionEv'
/usr/lib/i386-linux-gnu/libboost_signals.so.1.54.0: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status@
I can deal with the warnings but would like to know how I would "switch" to Boost.Signals2 if necessary. The error regarding "undefined reference to symbol", I am unfamiliar with at all.
RE: Getting Started Compiler Errors - Added by Wim Dumon over 11 years ago
Hello Takumi,
The warning can be safely ignored, newer versions of Wt will choose signals2 on recent boost versions.
The linker errors must be resolved by adding the appropriate libraries to the command line:
g++ -lwt -lwthttp hello.C -o hello_test.wt -lboost_signals
On linux, it depends a bit on the distribution and the version of compiler/linker which libraries you have to add. Sometimes the command as you typed it works, sometimes you also have to add the boost libraries you use. So you may have to add more libraries in order to resolve all linker errors.
BR,
Wim.
RE: Getting Started Compiler Errors - Added by Takumi Kego over 11 years ago
Thank you once again, that did it. Thanks for the comprehensive explanation as well.
RE: Getting Started Compiler Errors - Added by Lindo Softer about 11 years ago
Hello,
on execute over ubuntu 14
g -lwt -lwthttp hello.C -o hello_test.wt -lboost_signals
get this:
In file included from /usr/include/Wt/WSignal:17:0,
from /usr/include/Wt/WWidget:14,
from /usr/include/Wt/WWebWidget:14,
from /usr/include/Wt/WBreak:10,
from /usr/include/Wt/WCssStyleSheet:14,
from /usr/include/Wt/WApplication:26,
from hello.C:7:
/usr/include/boost/signal.hpp:17:4: warning: #warning "Boost.Signals is no longer being maintained and is now deprecated. Please switch to Boost.Signals2. To disable this warning message, define BOOST_SIGNALS_NO_DEPRECATION_WARNING." [-Wcpp]
# warning "Boost.Signals is no longer being maintained and is now deprecated. Please switch to Boost.Signals2. To disable this warning message, define BOOST_SIGNALS_NO_DEPRECATION_WARNING."
^
/tmp/ccZBmrAe.o: En la función `HelloApplication::HelloApplication(Wt::WEnvironment const&)':
hello.C:(.text+0x1b): referencia a `Wt::WApplication::WApplication(Wt::WEnvironment const&, Wt::WtLibVersion)' sin definir
hello.C:(.text+0x3f): referencia a `Wt::WString::WString(char const*, Wt::CharEncoding)' sin definir
hello.C:(.text+0x51): referencia a `Wt::WApplication::setTitle(Wt::WString const&)' sin definir
hello.C:(.text+0x5c): referencia a `Wt::WString::~WString()' sin definir
hello.C:(.text+0x90): referencia a `Wt::WString::WString(char const*, Wt::CharEncoding)' sin definir
hello.C:(.text+0xb5): referencia a `Wt::WText::WText(Wt::WString const&, Wt::WContainerWidget*)' sin definir
hello.C:(.text+0xcc): referencia a `Wt::WString::~WString()' sin definir
hello.C:(.text+0xf3): referencia a `Wt::WLineEdit::WLineEdit(Wt::WContainerWidget*)' sin definir
hello.C:(.text+0x10d): referencia a `Wt::WFormWidget::setFocus()' sin definir
hello.C:(.text+0x128): referencia a `Wt::WString::WString(char const*, Wt::CharEncoding)' sin definir
hello.C:(.text+0x156): referencia a `Wt::WPushButton::WPushButton(Wt::WString const&, Wt::WContainerWidget*)' sin definir
hello.C:(.text+0x164): referencia a `Wt::WString::~WString()' sin definir
hello.C:(.text+0x19c): referencia a `Wt::WLength::WLength(int, Wt::WLength::Unit)' sin definir
hello.C:(.text+0x1e6): referencia a `Wt::WBreak::WBreak(Wt::WContainerWidget*)' sin definir
hello.C:(.text+0x216): referencia a `Wt::WText::WText(Wt::WContainerWidget*)' sin definir
hello.C:(.text+0x238): referencia a `Wt::WInteractWidget::clicked()' sin definir
hello.C:(.text+0x2ac): referencia a `Wt::WInteractWidget::enterPressed()' sin definir
hello.C:(.text+0x2e2): referencia a `Wt::WString::~WString()' sin definir
hello.C:(.text+0x2fd): referencia a `Wt::WString::~WString()' sin definir
hello.C:(.text+0x328): referencia a `Wt::WString::~WString()' sin definir
hello.C:(.text+0x351): referencia a `Wt::WApplication::~WApplication()' sin definir
/tmp/ccZBmrAe.o: En la función `HelloApplication::greet()':
hello.C:(.text+0x393): referencia a `Wt::operator+(char const*, Wt::WString const&)' sin definir
hello.C:(.text+0x3ae): referencia a `Wt::WText::setText(Wt::WString const&)' sin definir
hello.C:(.text+0x3b9): referencia a `Wt::WString::~WString()' sin definir
hello.C:(.text+0x3c8): referencia a `Wt::WString::~WString()' sin definir
/tmp/ccZBmrAe.o: En la función `main':
hello.C:(.text+0x45b): referencia a `Wt::WRun(int, char, boost::function<Wt::WApplication* (Wt::WEnvironment const&)>)' sin definir
/tmp/ccZBmrAe.o: En la función `boost::signals::connection Wt::EventSignalWt::WMouseEvent::connect<HelloApplication, HelloApplication>(HelloApplication*, void (HelloApplication::)())':
hello.C:(.text._ZN2Wt11EventSignalINS_11WMouseEventEE7connectI16HelloApplicationS4_EEN5boost7signals10connectionEPT_MT0_FvvE[_ZN2Wt11EventSignalINS_11WMouseEventEE7connectI16HelloApplicationS4_EEN5boost7signals10connectionEPT_MT0_FvvE]+0xe): referencia a `Wt::EventSignalBase::exposeSignal()' sin definir
hello.C:(.text._ZN2Wt11EventSignalINS_11WMouseEventEE7connectI16HelloApplicationS4_EEN5boost7signals10connectionEPT_MT0_FvvE[_ZN2Wt11EventSignalINS_11WMouseEventEE7connectI16HelloApplicationS4_EEN5boost7signals10connectionEPT_MT0_FvvE]+0x57): referencia a `Wt::WObject::isStateless(void (Wt::WObject::*)())' sin definir
hello.C:(.text._ZN2Wt11EventSignalINS_11WMouseEventEE7connectI16HelloApplicationS4_EEN5boost7signals10connectionEPT_MT0_FvvE[_ZN2Wt11EventSignalINS_11WMouseEventEE7connectI16HelloApplicationS4_EEN5boost7signals10connectionEPT_MT0_FvvE]+0x8e): referencia a `Wt::EventSignalBase::connectStateless(void (Wt::WObject::)(), Wt::WObject, Wt::WStatelessSlot*)' sin definir
/tmp/ccZBmrAe.o: En la función `boost::signals::connection Wt::EventSignalWt::NoClass::connect<boost::_bi::bind_t<void, boost::_mfi::mf0<void, HelloApplication>, boost::_bi::list1<boost::_bi::value<HelloApplication*> > > >(boost::_bi::bind_t<void, boost::_mfi::mf0<void, HelloApplication>, boost::_bi::list1<boost::_bi::value<HelloApplication*> > > const&)':
hello.C:(.text.*ZN2Wt11EventSignalINS_7NoClassEE7connectIN5boost3_bi6bind_tIvNS4_4_mfi3mf0Iv16HelloApplicationEENS5_5list1INS5_5valueIPS9_EEEEEEEENS4_7signals10connectionERKTZN2Wt11EventSignalINS_7NoClassEE7connectIN5boost3_bi6bind_tIvNS4_4_mfi3mf0Iv16HelloApplicationEENS5_5list1INS5_5valueIPS9_EEEEEEEENS4_7signals10connectionERKT+0xe): referencia a `Wt::EventSignalBase::exposeSignal()' sin definir
/tmp/ccZBmrAe.o:(.rodata._ZTV16HelloApplication[_ZTV16HelloApplication]+0x10): referencia a `Wt::WObject::id() const' sin definir
/tmp/ccZBmrAe.o:(.rodata._ZTV16HelloApplication[_ZTV16HelloApplication]+0x14): referencia a `Wt::WObject::objectName() const' sin definir
/tmp/ccZBmrAe.o:(.rodata._ZTV16HelloApplication[_ZTV16HelloApplication]+0x18): referencia a `Wt::WObject::removeChild(Wt::WObject*)' sin definir
/tmp/ccZBmrAe.o:(.rodata._ZTV16HelloApplication[_ZTV16HelloApplication]+0x1c): referencia a `Wt::WObject::hasParent() const' sin definir
/tmp/ccZBmrAe.o:(.rodata._ZTV16HelloApplication[_ZTV16HelloApplication]+0x20): referencia a `Wt::WObject::signalConnectionsChanged()' sin definir
/tmp/ccZBmrAe.o:(.rodata._ZTV16HelloApplication[_ZTV16HelloApplication]+0x24): referencia a `Wt::WObject::setParent(Wt::WObject*)' sin definir
/tmp/ccZBmrAe.o:(.rodata._ZTV16HelloApplication[_ZTV16HelloApplication]+0x28): referencia a `Wt::WObject::setFormData(Wt::WObject::FormData const&)' sin definir
/tmp/ccZBmrAe.o:(.rodata._ZTV16HelloApplication[_ZTV16HelloApplication]+0x2c): referencia a `Wt::WObject::setRequestTooLarge(long long)' sin definir
/tmp/ccZBmrAe.o:(.rodata._ZTV16HelloApplication[_ZTV16HelloApplication]+0x30): referencia a `Wt::WObject::getStateless(void (Wt::WObject::*)())' sin definir
/tmp/ccZBmrAe.o:(.rodata._ZTV16HelloApplication[_ZTV16HelloApplication]+0x34): referencia a `Wt::WApplication::refresh()' sin definir
/tmp/ccZBmrAe.o:(.rodata._ZTV16HelloApplication[_ZTV16HelloApplication]+0x38): referencia a `Wt::WApplication::makeAbsoluteUrl(std::string const&) const' sin definir
/tmp/ccZBmrAe.o:(.rodata._ZTV16HelloApplication[_ZTV16HelloApplication]+0x3c): referencia a `Wt::WApplication::initialize()' sin definir
/tmp/ccZBmrAe.o:(.rodata._ZTV16HelloApplication[_ZTV16HelloApplication]+0x40): referencia a `Wt::WApplication::finalize()' sin definir
/tmp/ccZBmrAe.o:(.rodata._ZTV16HelloApplication[_ZTV16HelloApplication]+0x44): referencia a `Wt::WApplication::notify(Wt::WEvent const&)' sin definir
/tmp/ccZBmrAe.o:(.rodata._ZTV16HelloApplication[_ZTV16HelloApplication]+0x48): referencia a `Wt::WApplication::isExposed(Wt::WWidget*) const' sin definir
/tmp/ccZBmrAe.o:(.rodata._ZTV16HelloApplication[_ZTV16HelloApplication]+0x4c): referencia a `Wt::WApplication::enableAjax()' sin definir
/tmp/ccZBmrAe.o:(.rodata._ZTV16HelloApplication[_ZTV16HelloApplication]+0x50): referencia a `Wt::WApplication::unload()' sin definir
/tmp/ccZBmrAe.o: En la función `HelloApplication::~HelloApplication()':
hello.C:(.text._ZN16HelloApplicationD2Ev[_ZN16HelloApplicationD5Ev]+0x16): referencia a `Wt::WApplication::~WApplication()' sin definir
/tmp/ccZBmrAe.o:(.rodata._ZTI16HelloApplication[_ZTI16HelloApplication]+0x8): referencia a `typeinfo for Wt::WApplication' sin definir
collect2: error: ld returned 1 exit status
How i can compile this example Hello.C on Ubuntu wihtou warning? or correct way?
RE: Getting Started Compiler Errors - Added by Robi K about 11 years ago
Hello Lindo,
Not shure it solves the problem but I had to link to boost_system on Fedora ( -lboost_system ) instead of boost_signals.
cheers, rob
RE: Getting Started Compiler Errors - Added by Koen Deforche about 11 years ago
Hey Lindo,
The order of arguments is important. It should be:
g hello.C -o hello_test.wt -lwt -lwthttp -lboost_signals
The reason is that, under certain circumstances, the linker will resolve dependencies only from subsequent libraries in the command line. So it's a good habit to list them in the right order, and after all the object (or cpp) files.
Regards,
koen
RE: Getting Started Compiler Errors - Added by Lindo Softer about 11 years ago
Perfect!, now im want to learn Wt, thankyou, Good look!.