Exceptions during Hello World
Added by Nick Onorato over 4 years ago
Hi,
I recently wanted to try out WT but have been running into a problem. I'm using Windows 10, Visual Studio 2019 community and WT 4.1.1. When I run the program the server seems to start up just fine but when I navigate to the url an exception is thrown
Exception thrown: read access violation.
this->prev was 0xFFFFFFFFFFFFFFD7.
Here's the call stack
@ WT_Attempt_02.exe!Wt::Signals::Impl::ProtoSignalWt::WMouseEvent::SignalLink::add_before(Wt::Signals::Impl::ProtoSignalWt::WMouseEvent::SignalLink * link) Line 136 C
WT_Attempt_02.exe!Wt::Signals::Impl::ProtoSignalWt::WMouseEvent::SignalLink::add_before(std::function<void __cdecl(Wt::WMouseEvent)> && cb, const Wt::Core::observable * object) Line 146 C
WT_Attempt_02.exe!Wt::Signals::Impl::ProtoSignalWt::WMouseEvent::connect(std::function<void __cdecl(Wt::WMouseEvent)> && cb, const Wt::Core::observable * object) Line 196 C
WT_Attempt_02.exe!Wt::EventSignalWt::WMouseEvent::connect<HelloApplication,HelloApplication>(HelloApplication * target, void(HelloApplication::*)() method) Line 832 C
WT_Attempt_02.exe!HelloApplication::HelloApplication(const Wt::WEnvironment & env) Line 56 C
WT_Attempt_02.exe!Wt::cpp14::make_unique<HelloApplication,Wt::WEnvironment const &>(const Wt::WEnvironment & ) Line 24 C
WT_Attempt_02.exe!main::__l2::(const Wt::WEnvironment & env) Line 98 C@
Otherwise the code is exactly the same as the tutorial found here https://www.webtoolkit.eu/wt/doc/tutorial/wt.html
Specifically the exception occurs first on the line
button->clicked().connect(greet);
Which may mean something about the signal, slot mechanism isn't working correctly? Maybe boost related.
I'm at a loss, thanks in advance if you have any ideas.
Replies (3)
RE: Exceptions during Hello World - Added by Roel Standaert over 4 years ago
Hello Nick,
You probably have a mismatch between the Wt build and your project. Are you building a release build with Wt's debug libs (wtd.lib and wthttpd.lib), or a debug build with Wt's release libs (wt.lib and wthttp.lib)?
Regards,
Roel
RE: Exceptions during Hello World - Added by Nick Onorato over 4 years ago
All hail Roel!
That was indeed the problem, I was building a debug build with the release libs. Although to be honest I'm not sure why that doesn't work.
Thank you, I am very grateful.
RE: Exceptions during Hello World - Added by Roel Standaert over 4 years ago
Release and debug versions of C libraries are generally not binary compatible on Windows.