Issue with Boost 1.64 and Visual Studio 2017 - c++

I'm upgrading the libraries to MSVC 141 and moving to Visual Studio 2017.
I've downloaded the newest Boost libraries (boost_1_64_0_b2-msvc-14.1-64.exe). When building the code, I get this error:
...\boost\move\detail\type_traits.hpp(757): error C2187: syntax error:
')' was unexpected here ...\boost\move\detail\type_traits.hpp(763):
note: see reference to class template instantiation
'boost::move_detail::is_copy_constructible' being compiled
In the mentioned header, BOOST_MOVE_TT_CXX11_IS_COPY_CONSTRUCTIBLE is defined but the latest MSVC doesn't understand the enclosed code.
Undefining this macro helps, but it there a better solution to fix this? What's the reason here?

As suggested here, undefine macro U after each inclusion of cpprest headers or before inclusion of boost headers.
Example:
#include <cpprest/http_client.h>
#undef U

need include -
#define _TURN_OFF_PLATFORM_STRING
"#include <cpprest/details/basic_types.h>"
....
see:
https://github.com/Microsoft/vcpkg/issues/836

Related

Compile error inside boost: "use of undefined type 'boost::mpl::bool_<true>"

I am getting this strange error when compiling a large CPP file, at this line:
#include <boost/regex/v4/regex.hpp>
Error C2027 use of undefined type
'boost::mpl::bool_'
C:\github\microsoft\vcpkg\installed\x86-windows\include\boost\regex\v4\basic_regex_parser.hpp 59
In bool_fwd.hpp I see:
typedef bool_<true> true_;
typedef bool_<false> false_;
In basic_regex_parser.hpp this is the line generating the error:
inline boost::intmax_t umax()
{
return umax(mpl::bool_<std::numeric_limits<boost::intmax_t>::digits >= std::numeric_limits<std::size_t>::digits>());
}
It appears basic_regex_parser.hpp isn't including bool_fwd.hpp but diving into these files I am lost what's wrong.
I've moved that #include to be right at the top of my stdafx.h file so it's before any other headers, and get the same result. We've recently switched from manually building boost 1.68 => 1.76 via vcpkg but I don't know which if either is the cause. We also switched to C++17 and I note boost has a dependency on std::numeric_limits, could this is the issue?
This isn't supported, see same issue in https://github.com/boostorg/regex/issues/145

deprecated warnings while using boost.spirit

I am trying to write some parsers with boost.spirit.qi but when i am compiling i am getting the following deprecated warnings:
In file included from /usr/include/boost/iostreams/detail/is_dereferenceable.hpp:12:0 ...
#pragma message: NOTE: Use of this header (bool_trait_def.hpp) is deprecated
#pragma message: NOTE: Use of this header (template_arity_spec.hpp) is deprecated
Am i using the wrong parsers or something old? How can I get rid of these warnings?
EDIT: The /usr/include/boost/iostreams/detail/is_dereferenceable.hpp is somehow included by /usr/include/boost/spirit/include/qi.hpp
I am using Boost Version 1.61
I had a similar issue using the boost geometry package and could not upgrade boost to fix the error.
Disable boost deprecated warnings with the below define:
#define BOOST_ALLOW_DEPRECATED_HEADERS
#define BOOST_BIND_GLOBAL_PLACEHOLDERS
Note the second define handles a common warning that occurs alongside of the deprecated warning and may not be needed.

Need to include strsafe.h after tchar.h Error

I'm trying to build application using Visual studio 2012 I'm getting following error while compiling
C:\Program Files\Microsoft Visual Studio 11.0\VC\include\tchar.h(24): fatal error C1189: #error : Need to include strsafe.h after tchar.h
i included tchar.h after strsafe.h in stdafx.h file. still i'm getting same error . how to troubleshoot this problem
Reverse the order of inclusion? The error states that you should(*)
include strsafe.h after tchar.h. – Joachim Pileborg May 31 '13 at
8:25
(*) == must
Move the #include for tchar.h up in the list of includes. And do consider not including it at all, these tchar practices date from the
previous century. There is no version of Windows left that still needs
it. The floppy disk drive on the last machine that still boots a
non-Unicode version of Windows died last week, problem solved. – Hans
Passant May 31 '13 at 12:50
Try adding #include at the top of all headers
Try adding #include at the top of all headers. it Worked for me.
it is from the post
https://social.msdn.microsoft.com/Forums/vstudio/en-US/856e1cf6-d5bd-4e04-88eb-ea3aba3e8edc/why-getting-compile-error-need-to-include-strsafeh-after-tcharh?forum=vcgeneral

Syntax Error Message from MSR_NUIAPI.h

My issue is this, every time that I compile my program which includes the MSR_NUIAPI.h, the compiler spits out a missing ';' before the INUIInstance interface declaration. I read this article(http://social.msdn.microsoft.com/Forums/en-ca/kinectsdknuiapi/thread/01b954d2-4095-4b2b-8713-7b47843d8752) which says that I have to include windows.h file before the MSR_NUIAPI.h, however I already have it included before, and I really doubt that this is an actual syntax mistake. IntelliSense(I'm using VS Studio Ultimate) however says that 'interface' is not defined.
Thank You
Try including #include <ole2.h> after #include <windows.h>.
Also, MSR_NuiApi.h was included in the beta distribution and is not part of the v1.0 SDK. Its now just NuiApi.h.
Download Kinect SDK v1.0

iphlpapi / ifdef.h

I'm trying to use iphlpapi (GetAdapterInfo) and am having trouble compiling the code. I have iphlpapi.h from SDK 7 and have added the appropriate path to the include files in visual studio.
I get the following error...
c:\program files\microsoft sdks\windows\v7.0\include\ifdef.h(154) : error C2146: syntax error : missing ';' before identifier 'NET_IFTYPE'
The lines in ifdef where this occurs are shown below.
typedef NET_LUID IF_LUID, *PIF_LUID;
typedef ULONG NET_IFINDEX, *PNET_IFINDEX; // Interface Index (ifIndex)
typedef UINT16 NET_IFTYPE, *PNET_IFTYPE; // Interface Type (IANA ifType)
I finally figured out how to get this to work so I'm putting this here for others who might stumble upon it.
First, I'm using visual c++ version 6.0 with the 2003 sdk. I added the sdk as the first choice using TOOLS->OPTIONS->DIRECTORIES. Adding the include winsock2.h caused about 60 redefinition errors. I found several sources telling me that the winsock2 include had to precede the windows.h include. My windows.h include was generated for me by VC++ in the precompiled header stdafx.h so I moved the winsock2.h include there. I now can compile and run my program!
According to this page, it looks as though you might need to make sure winsock2.h is included first. I'm guessing that it defines some of those types.
Also, the MSDN page for NET_LUID says it requires Vista at a minimum. Make sure that's true.