June 24, 2012

Phileas Fogg Phileas Fogg
Lab Rat
2 posts

Boost::lexical_cast error when usin Qtcreator with MSVC2010 compiler, but no error when using VisualStudio for the same code

 

Hi,
I’m right now porting an console app i wrote using VS2010exp into Qt creator (widget based project).
I use boost::lexical_cast extensively in the code. In Vs it compiles and runs fine. The same code in Qt results in an error (without indicating a special line of code):

  1. *c:\Program\boost\boost_1_47\boost\lexical_cast.hpp:1116: error: C2535: 'bool boost::detail::lexical_stream_limited_src<CharT,Base,Traits>::operator >>(unsigned short &)' : member function already defined or declared
  2. with
  3. [
  4. CharT=char_type,
  5. Base=base,
  6. Traits=traits
  7. ]
  8. c:\Program\boost\boost_1_47\boost\lexical_cast.hpp:993: see declaration of 'boost::detail::lexical_stream_limited_src<CharT,Base,Traits>::operator >>'
  9. with
  10. [
  11. CharT=char_type,
  12. Base=base,
  13. Traits=traits
  14. ]
  15. c:\Program\boost\boost_1_47\boost\lexical_cast.hpp:1524: see reference to class template instantiation 'boost::detail::lexical_stream_limited_src<CharT,Base,Traits>' being compiled
  16. with
  17. [
  18. CharT=char_type,
  19. Base=base,
  20. Traits=traits
  21. ]
  22. c:\Program\boost\boost_1_47\boost\lexical_cast.hpp:1653: see reference to function template instantiation 'Target boost::detail::lexical_cast<Target,src,false,char_type>(const std::basic_string<_Elem,_Traits,_Ax> &,CharT *,size_t)' being compiled
  23. with
  24. [
  25. Target=float,
  26. _Elem=wchar_t,
  27. _Traits=std::char_traits<wchar_t>,
  28. _Ax=std::allocator<wchar_t>,
  29. CharT=char_type
  30. ]
  31. c:\Program\boost\boost_1_47\boost\lexical_cast.hpp:1641: while compiling class template member function 'float boost::detail::lexical_cast_do_cast<Target,Source>::lexical_cast_impl(const Source &)'
  32. with
  33. [
  34. Target=float,
  35. Source=src
  36. ]
  37. c:\Program\boost\boost_1_47\boost\lexical_cast.hpp:1813: see reference to class template instantiation 'boost::detail::lexical_cast_do_cast<Target,Source>' being compiled
  38. with
  39. [
  40. Target=float,
  41. Source=src
  42. ]
  43. c:\Program\boost\boost_1_47\boost\lexical_cast.hpp:1813: see reference to class template instantiation 'boost::detail::lexical_cast_do_cast<Target,Source>' being compiled
  44. with
  45. [
  46. Target=float,
  47. Source=src
  48. ]*

I have no clue what could cause this. Has anyone a hint for me? Thanks

[edit] code tags added, koahnig

2 replies

June 24, 2012

Tobias Hunger Tobias Hunger
Mad Scientist
3135 posts

Which compiler are you using in Qt Creator? The microsoft or the mingw one?

June 24, 2012

Phileas Fogg Phileas Fogg
Lab Rat
2 posts

The Microsoft one…
And it’s Boost 1_47 I use.

 
  ‹‹ Error using Qt + gSOAP      cross compiling from ubuntu to windows ››

You must log in to post a reply. Not a member yet? Register here!