Project

General

Profile

Wt::Dbo::jsonSerialize undefined reference to `std::enable_if

Added by Mark Petryk over 6 years ago

I'm not sure what to make of this linker error:

276     template<class Action> void persist( Action & a )·
277     {·
278       Wt::Dbo::field( a, m_cursorPosition, "cursorPosition" );·
279       Wt::Dbo::field( a, m_isAutoSubmit,   "isAutoSubmit"   );·
280       Wt::Dbo::field( a, m_isPrivate,      "isPrivate"      );·
281       Wt::Dbo::field( a, m_isPreserve,     "isPreserve"     );·
282       Wt::Dbo::field( a, m_text,           "text"           );·
283     }·
284 ·

326 bool PastebinFile::save()·
327 {·
342 ·                                                                                                                                                                                                           
343   Wt::Dbo::jsonSerialize( *this, std::cout );·
344 ·
349   return true;·
350 ·
351 } // endbool PastebinFile::save()·
352 ·

The interesting error message below is: \"undef ref to std::enable_if...

Scanning dependencies of target pastebin
[  3%] Building CXX object CMakeFiles/pastebin.dir/src/main.cpp.o
[  6%] Linking CXX executable pastebin
CMakeFiles/pastebin.dir/src/main.cpp.o: In function `void Wt::Dbo::field<Wt::Dbo::JsonSerializer, Wt::WString>(Wt::Dbo::JsonSerializer&, Wt::WString&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int)':
main.cpp:(.text._ZN2Wt3Dbo5fieldINS0_14JsonSerializerENS_7WStringEEEvRT_RT0_RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEi[_ZN2Wt3Dbo5fieldINS0_14JsonSerializerENS_7WStringEEEvRT_RT0_RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEi]+0x53): undefined reference to `std::enable_if<!std::is_enum<Wt::WString>::value, void>::type Wt::Dbo::JsonSerializer::act<Wt::WString>(Wt::Dbo::FieldRef<Wt::WString>)'
collect2: error: ld returned 1 exit status
CMakeFiles/pastebin.dir/build.make:848: recipe for target 'pastebin' failed
make[2]: *** [pastebin] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/pastebin.dir/all' failed
make[1]: *** [CMakeFiles/pastebin.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2

Replies (1)

RE: Wt::Dbo::jsonSerialize undefined reference to `std::enable_if - Added by Mark Petryk over 6 years ago

Never mind!!! I love how I manage to solve my problems right after I post them on-line.... argh!

The issue is here:

282       Wt::Dbo::field( a, m_text,           "text"           );·

The m_text member was a WString. The solution is to change it to a std::string.

    (1-1/1)