Boost beast integration issues in UE4 plugin? - c++

I am trying to create a UE4 plugin then I can simply create a blueprint function like so using Boost Beast client example :
void UBoostBPFunctionLibrary::ConnectWebsocket(FString inMessage, FString& outResStr)
{
//using tcp = boost::asio::ip::tcp; // from <boost/asio/ip/tcp.hpp>
//namespace websocket = boost::beast::websocket; // from <boost/beast/websocket.hpp>
//auto const host = "127.0.0.1";
//auto const port = "8080";
//std::string text(TCHAR_TO_ANSI(*inMessage));
//// The io_context is required for all I/O
//boost::asio::io_context ioc;
//// These objects perform our I/O
//tcp::resolver resolver{ ioc };
//websocket::stream<tcp::socket> ws{ ioc };
//// Look up the domain name
//auto const results = resolver.resolve(host, port);
//// Make the connection on the IP address we get from a lookup
//boost::asio::connect(ws.next_layer(), results.begin(), results.end());
//// Perform the websocket handshake
//ws.handshake(host, "/");
//// Send the message
//ws.write(boost::asio::buffer(std::string(text)));
//// This buffer will hold the incoming message
//boost::beast::multi_buffer buffer;
//// Read a message into our buffer
//ws.read(buffer);
//// Close the WebSocket connection
//ws.close(websocket::close_code::normal);
////// If we get here then the connection is closed gracefully
//// // The buffers() function helps print a ConstBufferSequence
//outResStr = FString(boost::beast::to_static_string(boost::beast::buffers(buffer.data())).c_str());
}
But as I try to compile simply by including the following header files in my BoostBPFunctionLibrary.h :
#include <boost/beast/core.hpp>
#include <boost/beast/websocket.hpp>
#include <boost/asio/connect.hpp>
#include <boost/asio/ip/tcp.hpp>
I get loads of errors such as the following. I guess the errors are all pointing to the clash of check definition in "AssertionMacros.h" and any boost version of it, but the question then is how can I fix that and make it work ? Why is there no clear fundamental separation between the two definitions ? I tried to remove the boost version of "check function" as pointed by the first error line but that breaks other code files in boost, I tried to do that to UE4 and the answer is still no. I feel that there is something fundamentally wrong here. Please advice.
2>C:\Users\Alam Syed\Documents\Unreal Projects\SomeProject\Plugins\PCL\Source\PCL\Boost\include\boost-root\boost/intrusive/list.hpp(1333): error C4003: not enough arguments for function-like macro invocation 'check'
2>C:\Users\Alam Syed\Documents\Unreal Projects\SomeProject\Plugins\PCL\Source\PCL\Boost\include\boost-root\boost/intrusive/list.hpp(1333): error C2062: type 'void' unexpected
2>C:\Users\Alam Syed\Documents\Unreal Projects\SomeProject\Plugins\PCL\Source\PCL\Boost\include\boost-root\boost/intrusive/list.hpp(1405): note: see reference to class template instantiation 'boost::intrusive::list_impl<ValueTraits,SizeType,ConstantTimeSize,HeaderHolder>' being compiled
2>C:\Users\Alam Syed\Documents\Unreal Projects\SomeProject\Plugins\PCL\Source\PCL\Boost\include\boost-root\boost/intrusive/list.hpp(1333): error C2334: unexpected token(s) preceding '{'; skipping apparent function body
2>C:\Users\Alam Syed\Documents\Unreal Projects\SomeProject\Plugins\PCL\Source\PCL\Boost\include\boost-root\boost/intrusive/list.hpp(1334): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
2>C:\Users\Alam Syed\Documents\Unreal Projects\SomeProject\Plugins\PCL\Source\PCL\Boost\include\boost-root\boost/intrusive/list.hpp(1334): error C2059: syntax error: '{'
2>C:\Users\Alam Syed\Documents\Unreal Projects\SomeProject\Plugins\PCL\Source\PCL\Boost\include\boost-root\boost/intrusive/list.hpp(1334): error C2334: unexpected token(s) preceding '{'; skipping apparent function body
2>C:\Users\Alam Syed\Documents\Unreal Projects\SomeProject\Plugins\PCL\Source\PCL\Boost\include\boost-root\boost/intrusive/bstree_algorithms.hpp(1452): warning C4002: too many arguments for function-like macro invocation 'check'
2>C:\Users\Alam Syed\Documents\Unreal Projects\SomeProject\Plugins\PCL\Source\PCL\Boost\include\boost-root\boost/intrusive/bstree_algorithms.hpp(1452): error C2988: unrecognizable template declaration/definition
2> C:\Users\Alam Syed\Documents\Unreal Projects\SomeProject\Plugins\PCL\Source\PCL\Boost\include\boost-root\boost/intrusive/bstree_algorithms.hpp(2074): note: see reference to class template instantiation 'boost::intrusive::bstree_algorithms<NodeTraits>' being compiled
2> C:\Users\Alam Syed\Documents\Unreal Projects\SomeProject\Plugins\PCL\Source\PCL\Boost\include\boost-root\boost/beast/core/string.hpp(87): note: see reference to class template instantiation 'boost::basic_string_view<char,std::char_traits<char>>' being compiled
2>C:\Users\Alam Syed\Documents\Unreal Projects\SomeProject\Plugins\PCL\Source\PCL\Boost\include\boost-root\boost/intrusive/bstree_algorithms.hpp(1452): error C2059: syntax error: '<end Parse>'
2>C:\Users\Alam Syed\Documents\Unreal Projects\SomeProject\Plugins\PCL\Source\PCL\Boost\include\boost-root\boost/intrusive/bstree_algorithms.hpp(1452): error C2334: unexpected token(s) preceding '{'; skipping apparent function body
2>C:\Users\Alam Syed\Documents\Unreal Projects\SomeProject\Plugins\PCL\Source\PCL\Boost\include\boost-root\boost/intrusive/bstree_algorithms.hpp(1453): error C2988: unrecognizable template declaration/definition
2>C:\Users\Alam Syed\Documents\Unreal Projects\SomeProject\Plugins\PCL\Source\PCL\Boost\include\boost-root\boost/intrusive/bstree_algorithms.hpp(1453): error C2059: syntax error: '{'
2>C:\Users\Alam Syed\Documents\Unreal Projects\SomeProject\Plugins\PCL\Source\PCL\Boost\include\boost-root\boost/intrusive/bstree_algorithms.hpp(1453): error C2334: unexpected token(s) preceding '{'; skipping apparent function body
2>C:\Users\Alam Syed\Documents\Unreal Projects\SomeProject\Plugins\PCL\Source\PCL\Boost\include\boost-root\boost/intrusive/bstree.hpp(2074): error C4003: not enough arguments for function-like macro invocation 'check'
2>C:\Users\Alam Syed\Documents\Unreal Projects\SomeProject\Plugins\PCL\Source\PCL\Boost\include\boost-root\boost/intrusive/bstree.hpp(2057): error C2988: unrecognizable template declaration/definition
2> C:\Users\Alam Syed\Documents\Unreal Projects\SomeProject\Plugins\PCL\Source\PCL\Boost\include\boost-root\boost/intrusive/bstree.hpp(2122): note: see reference to class template instantiation 'boost::intrusive::bstree_impl<ValueTraits,VoidOrKeyOfValue,VoidOrKeyComp,SizeType,ConstantTimeSize,AlgoType,HeaderHolder>' being compiled
2>C:\Users\Alam Syed\Documents\Unreal Projects\SomeProject\Plugins\PCL\Source\PCL\Boost\include\boost-root\boost/intrusive/bstree.hpp(2057): error C2059: syntax error: '<end Parse>'
2>C:\Users\Alam Syed\Documents\Unreal Projects\SomeProject\Plugins\PCL\Source\PCL\Boost\include\boost-root\boost/intrusive/bstree.hpp(2057): error C2334: unexpected token(s) preceding '{'; skipping apparent function body
2>C:\Users\Alam Syed\Documents\Unreal Projects\SomeProject\Plugins\PCL\Source\PCL\Boost\include\boost-root\boost/intrusive/bstree.hpp(2058): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
2>C:\Users\Alam Syed\Documents\Unreal Projects\SomeProject\Plugins\PCL\Source\PCL\Boost\include\boost-root\boost/intrusive/bstree.hpp(2058): error C2988: unrecognizable template declaration/definition
2>C:\Users\Alam Syed\Documents\Unreal Projects\SomeProject\Plugins\PCL\Source\PCL\Boost\include\boost-root\boost/intrusive/bstree.hpp(2058): error C2059: syntax error: '{'
2>C:\Users\Alam Syed\Documents\Unreal Projects\SomeProject\Plugins\PCL\Source\PCL\Boost\include\boost-root\boost/intrusive/bstree.hpp(2058): error C2334: unexpected token(s) preceding '{'; skipping apparent function body
2>C:\Users\Alam Syed\Documents\Unreal Projects\SomeProject\Plugins\PCL\Source\PCL\Boost\include\boost-root\boost/intrusive/bstree.hpp(2074): error C2062: type 'void' unexpected
2>C:\Users\Alam Syed\Documents\Unreal Projects\SomeProject\Plugins\PCL\Source\PCL\Boost\include\boost-root\boost/intrusive/bstree.hpp(2074): error C2334: unexpected token(s) preceding '{'; skipping apparent function body
2>C:\Users\Alam Syed\Documents\Unreal Projects\SomeProject\Plugins\PCL\Source\PCL\Boost\include\boost-root\boost/intrusive/bstree.hpp(2075): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
2>C:\Users\Alam Syed\Documents\Unreal Projects\SomeProject\Plugins\PCL\Source\PCL\Boost\include\boost-root\boost/intrusive/bstree.hpp(2075): error C2988: unrecognizable template declaration/definition
2>C:\Users\Alam Syed\Documents\Unreal Projects\SomeProject\Plugins\PCL\Source\PCL\Boost\include\boost-root\boost/intrusive/bstree.hpp(2075): error C2059: syntax error: '{'
2>C:\Users\Alam Syed\Documents\Unreal Projects\SomeProject\Plugins\PCL\Source\PCL\Boost\include\boost-root\boost/intrusive/bstree.hpp(2075): error C2334: unexpected token(s) preceding '{'; skipping apparent function body
2>C:\Users\Alam Syed\Documents\Unreal Projects\SomeProject\Plugins\PCL\Source\PCL\Boost\include\boost-root\boost/intrusive/bstree.hpp(2081): error C2988: unrecognizable template declaration/definition
2>C:\Users\Alam Syed\Documents\Unreal Projects\SomeProject\Plugins\PCL\Source\PCL\Boost\include\boost-root\boost/intrusive/bstree.hpp(2081): error C2059: syntax error: 'if'
2>C:\Users\Alam Syed\Documents\Unreal Projects\SomeProject\Plugins\PCL\Source\PCL\Boost\include\boost-root\boost/intrusive/bstree.hpp(2081): error C2334: unexpected token(s) preceding '{'; skipping apparent function body
2>C:\Users\Alam Syed\Documents\Unreal Projects\SomeProject\Plugins\PCL\Source\PCL\Boost\include\boost-root\boost/intrusive/bstree.hpp(2084): error C2988: unrecognizable template declaration/definition
2>C:\Users\Alam Syed\Documents\Unreal Projects\SomeProject\Plugins\PCL\Source\PCL\Boost\include\boost-root\boost/intrusive/bstree.hpp(2084): error C2059: syntax error: 'return'
2>C:\Users\Alam Syed\Documents\Unreal Projects\SomeProject\Plugins\PCL\Source\PCL\Boost\include\boost-root\boost/intrusive/bstree.hpp(2084): error C2238: unexpected token(s) preceding ';'
2>C:\Users\Alam Syed\Documents\Unreal Projects\SomeProject\Plugins\PCL\Source\PCL\Boost\include\boost-root\boost/intrusive/bstree.hpp(2087): error C2255: 'friend': not allowed outside of a class definition
2>C:\Users\Alam Syed\Documents\Unreal Projects\SomeProject\Plugins\PCL\Source\PCL\Boost\include\boost-root\boost/intrusive/bstree.hpp(2087): error C2144: syntax error: 'bool' should be preceded by ';'
2>C:\Users\Alam Syed\Documents\Unreal Projects\SomeProject\Plugins\PCL\Source\PCL\Boost\include\boost-root\boost/beast/http/detail/type_traits.hpp(36): error C2988: unrecognizable template declaration/definition
2> C:\Users\Alam Syed\Documents\Unreal Projects\SomeProject\Plugins\PCL\Source\PCL\Boost\include\boost-root\boost/beast/http/detail/type_traits.hpp(41): note: see reference to class template instantiation 'boost::beast::http::detail::is_header_impl<T>' being compiled
2>C:\Users\Alam Syed\Documents\Unreal Projects\SomeProject\Plugins\PCL\Source\PCL\Boost\include\boost-root\boost/beast/http/detail/type_traits.hpp(36): error C2059: syntax error: '<end Parse>'
2>C:\Users\Alam Syed\Documents\Unreal Projects\SomeProject\Plugins\PCL\Source\PCL\Boost\include\boost-root\boost/beast/http/detail/type_traits.hpp(36): error C2334: unexpected token(s) preceding '{'; skipping apparent function body
2>C:\Users\Alam Syed\Documents\Unreal Projects\SomeProject\Plugins\PCL\Source\PCL\Boost\include\boost-root\boost/beast/http/detail/type_traits.hpp(38): error C2226: syntax error: unexpected type 'std::false_type'
2>C:\Users\Alam Syed\Documents\Unreal Projects\SomeProject\Plugins\PCL\Source\PCL\Boost\include\boost-root\boost/beast/http/detail/type_traits.hpp(38): error C2334: unexpected token(s) preceding '{'; skipping apparent function body
2>C:\Users\Alam Syed\Documents\Unreal Projects\SomeProject\Plugins\PCL\Source\PCL\Boost\include\boost-root\boost/beast/http/detail/type_traits.hpp(40): error C2760: syntax error: unexpected token '{', expected 'expression'
2> Module.PCL.cpp

There is an answer - a sort of explanation as to why this is happening in unreal Engine forums for library macro conflicts. There is a dirty work around will try that.

Related

Why doesn't basic_regex support char8_t?

As the title says, the following code snippet generates C2027:
#include<regex>
using namespace std;
int main() {
basic_regex<char8_t> r;
return 0;
}
And the error msg was:
error C2027: use of undefined type 'std::regex_traits<char8_t>'
message : see declaration of 'std::regex_traits<char8_t>'
message : see reference to class template instantiation 'std::basic_regex<char8_t,std::regex_traits<char8_t>>' being compiled
error C2061: syntax error: identifier 'locale_type'
error C2027: use of undefined type 'std::regex_traits<char8_t>'
message : see declaration of 'std::regex_traits<char8_t>'
error C2061: syntax error: identifier 'string_type'
error C3646: 'imbue': unknown override specifier
error C2059: syntax error: '('
error C2334: unexpected token(s) preceding '{'; skipping apparent function body
error C3646: 'getloc': unknown override specifier
error C2059: syntax error: '('
error C2334: unexpected token(s) preceding '{'; skipping apparent function body
error C2079: 'std::basic_regex<char8_t,std::regex_traits<char8_t>>::_Traits' uses undefined class 'std::regex_traits<char8_t>'
But basic_regex<char> works
Can someone tell me why?
char and char8_t look like the same type in terms of their usage...
I'm using VS2021

Intel pin and chrono conflicts

I try to measure the runtime of the program using Intel Pin. For this purpose I include chrono in my project. However It is not going to compile well. It gives a lot of errors. Furthermore, I tried to include chrono to many standart Intel Pin examples - the same result.
Could you please help me to solve errors below?
ratio(24,32): error C2143: syntax error: missing ',' before '<'
ratio(25): message : see reference to class template instantiation 'std::_Abs<_Val>' being compiled
ratio(30,38): error C2143: syntax error: missing ',' before '<'
ratio(31): message : see reference to class template instantiation 'std::_Safe_mult<_Ax,_Bx,_Sfinae,_Good>' being compiled
ratio(40,36): error C2143: syntax error: missing ',' before '<'
ratio(41): message : see reference to class template instantiation 'std::_Sign_of<_Val>' being compiled
ratio(45,38): error C2143: syntax error: missing ',' before '<'
ratio(46): message : see reference to class template instantiation 'std::_Safe_addX<_Ax,_Bx,_Good,_Also_good>' being compiled
ratio(50,44): error C2760: syntax error: unexpected token ',', expected 'expression'
ratio(51): message : see reference to class template instantiation 'std::_Safe_addX<_Ax,_Bx,false,false>' being compiled
ratio(65,41): error C2143: syntax error: missing ',' before '<'
ratio(66): message : see reference to class template instantiation 'std::_GcdX<_Ax,0>' being compiled
ratio(74,2): error C2504: 'integral_constant': base class undefined
ratio(74,38): error C2143: syntax error: missing ',' before '<'
ratio(158,5): error C2065: 'void_t': undeclared identifier
ratio(158,1): error C2226: syntax error: unexpected type 'std::_Ratio_multiply<_R1,_R2>::_Num::type'
ratio(159,1): error C2988: unrecognizable template declaration/definition
ratio(159,1): error C2059: syntax error: '>'
ratio(159,58): error C2143: syntax error: missing ';' before '{'
ratio(159,58): error C2447: '{': missing function header (old-style formal list?)
ratio(186,35): error C2143: syntax error: missing ',' before '<'
ratio(188): message : see reference to class template instantiation 'std::ratio_equal<_R1,_R2>' being compiled
ratio(195,39): error C2143: syntax error: missing ',' before '<'
ratio(197): message : see reference to class template instantiation 'std::ratio_not_equal<_R1,_R2>' being compiled
ratio(252,34): error C2143: syntax error: missing ',' before '<'
ratio(254): message : see reference to class template instantiation 'std::ratio_less<_R1,_R2>' being compiled
ratio(261,40): error C2143: syntax error: missing ',' before '<'
ratio(263): message : see reference to class template instantiation 'std::ratio_less_equal<_R1,_R2>' being compiled
ratio(279,43): error C2143: syntax error: missing ',' before '<'
ratio(282): message : see reference to class template instantiation 'std::ratio_greater_equal<_R1,_R2>' being compiled
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\ucrt\corecrt.h(512,39): error C2371: 'wint_t': redefinition; different basic types
1>E:\Tools\source\pin\extras\crt\include\wchar.h(52): message : see declaration of 'wint_t'
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\ucrt\corecrt.h(513,39): error C2371: 'wctype_t': redefinition; different basic types
1>E:\Tools\source\pin\extras\crt\include\wchar.h(77): message : see declaration of 'wctype_t'
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\ucrt\corecrt.h(538,19): error C2371: 'mbstate_t': redefinition; different basic types
1>E:\Tools\source\pin\extras\crt\include\wchar.h(58): message : see declaration of 'mbstate_t'
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\ucrt\corecrt.h(552,28): error C2371: 'time_t': redefinition; different basic types
1>E:\Tools\source\pin\extras\crt\include\sys\types.h(91): message : see declaration of 'time_t'
vcruntime_new.h(34,26): error C2011: 'std::nothrow_t': 'struct' type redefinition
1>E:\Tools\source\pin\extras\libstdc++\include\new(10): message : see declaration of 'std::nothrow_t'
vcruntime_new.h(168,5): error C2084: function 'void *operator new(size_t,void *)' already has a body
1>E:\Tools\source\pin\extras\libstdc++\include\new(36): message : see previous definition of 'new'
vcruntime_new.h(174,5): error C2084: function 'void operator delete(void *,void *) throw()' already has a body
1>E:\Tools\source\pin\extras\libstdc++\include\new(40): message : see previous definition of 'delete'
vcruntime_new.h(184,5): error C2084: function 'void *operator new[](size_t,void *)' already has a body
1>E:\Tools\source\pin\extras\libstdc++\include\new(37): message : see previous definition of 'new[]'
vcruntime_new.h(190,5): error C2084: function 'void operator delete[](void *,void *) throw()' already has a body
1>E:\Tools\source\pin\extras\libstdc++\include\new(41): message : see previous definition of 'delete[]'
xtimec.h(28,15): error C2144: syntax error: 'int' should be preceded by ';'
xtimec.h(28,19): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
xtimec.h(30,15): error C2144: syntax error: 'long' should be preceded by ';'
xtimec.h(30,20): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
xtimec.h(30,1): error C2086: 'int _CRTIMP2': redefinition
xtimec.h(28): message : see declaration of '_CRTIMP2'
xtimec.h(31,15): error C2144: syntax error: 'long' should be preceded by ';'
xtimec.h(31,20): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
xtimec.h(31,1): error C2086: 'int _CRTIMP2': redefinition
xtimec.h(28): message : see declaration of '_CRTIMP2'
xtimec.h(32,15): error C2144: syntax error: '__int64' should be preceded by ';'
xtimec.h(32,25): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
xtimec.h(32,1): error C2086: 'int _CRTIMP2': redefinition
xtimec.h(28): message : see declaration of '_CRTIMP2'
xtimec.h(36,15): error C2144: syntax error: '__int64' should be preceded by ';'
xtimec.h(36,25): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
xtimec.h(36,1): error C2086: 'int _CRTIMP2': redefinition
xtimec.h(28): message : see declaration of '_CRTIMP2'
xtimec.h(37,15): error C2144: syntax error: '__int64' should be preceded by ';'
xtimec.h(37,25): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
xtimec.h(37,1): error C2086: 'int _CRTIMP2': redefinition
xtimec.h(28): message : see declaration of '_CRTIMP2'
chrono(28,55): error C2143: syntax error: missing ',' before '<'
chrono(29): message : see reference to class template instantiation 'std::chrono::treat_as_floating_point<_Rep>' being compiled
chrono(96,43): error C2143: syntax error: missing ';' before '<'
chrono(171): message : see reference to class template instantiation 'std::chrono::duration<_Rep,_Period>' being compiled
chrono(96,1): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
chrono(96,30): error C2126: 'std::chrono::duration<_Rep,_Period>::common_type_t' cannot be declared with 'constexpr' specifier
chrono(96,1): warning C4869: 'nodiscard' may only be applied to classes, enumerations, and functions
chrono(97,1): error C2334: unexpected token(s) preceding '{'; skipping apparent function body
chrono(101,43): error C2143: syntax error: missing ';' before '<'
chrono(101,1): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
chrono(101,30): error C2126: 'std::chrono::duration<_Rep,_Period>::common_type_t' cannot be declared with 'constexpr' specifier
chrono(101,1): warning C4869: 'nodiscard' may only be applied to classes, enumerations, and functions
chrono(102,1): error C2334: unexpected token(s) preceding '{'; skipping apparent function body
chrono(223,24): error C2143: syntax error: missing ',' before '<'
chrono(224): message : see reference to class template instantiation 'std::_Lcm<_Ax,_Bx>' being compiled
chrono(228,19): error C2988: unrecognizable template declaration/definition
chrono(228,19): error C2143: syntax error: missing ';' before '<'
chrono(228,19): error C2059: syntax error: '<'
chrono(228,37): error C2065: '_Rep1': undeclared identifier
chrono(228,44): error C2065: '_Period1': undeclared identifier
chrono(228,28): error C2923: 'std::chrono::duration': '_Rep1' is not a valid template type argument for parameter '_Rep'
chrono(228,28): error C2923: 'std::chrono::duration': '_Period1' is not a valid template type argument for parameter '_Period'
chrono(229,22): error C2065: '_Rep2': undeclared identifier
chrono(229,29): error C2065: '_Period2': undeclared identifier
chrono(229,13): error C2923: 'std::chrono::duration': '_Rep2' is not a valid template type argument for parameter '_Rep'
chrono(229,13): error C2923: 'std::chrono::duration': '_Period2' is not a valid template type argument for parameter '_Period'
chrono(229,40): error C2143: syntax error: missing ';' before '{'
chrono(229,40): error C2447: '{': missing function header (old-style formal list?)
chrono(235,8): error C2976: 'std::common_type': too few template arguments
chrono(228): message : see declaration of 'std::common_type'
chrono(238,2): error C2976: 'std::common_type': too few template arguments
chrono(236): message : see declaration of 'std::common_type'
chrono(243,39): error C2988: unrecognizable template declaration/definition
chrono(243,39): error C2143: syntax error: missing ';' before '<'
chrono(243,16): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
chrono(243,39): error C2059: syntax error: '<'
chrono(243,49): error C2065: '_Rep1': undeclared identifier
chrono(243,56): error C2065: '_Period1': undeclared identifier
chrono(243,40): error C2923: 'std::chrono::duration': '_Rep1' is not a valid template type argument for parameter '_Rep'
chrono(243,40): error C2923: 'std::chrono::duration': '_Period1' is not a valid template type argument for parameter '_Period'
chrono(243,76): error C2065: '_Rep2': undeclared identifier
chrono(243,83): error C2065: '_Period2': undeclared identifier
chrono(243,67): error C2923: 'std::chrono::duration': '_Rep2' is not a valid template type argument for parameter '_Rep'
chrono(243,67): error C2923: 'std::chrono::duration': '_Period2' is not a valid template type argument for parameter '_Period'
chrono(244,34): error C2065: '_Rep1': undeclared identifier
chrono(244,41): error C2065: '_Period1': undeclared identifier
chrono(244,25): error C2923: 'std::chrono::duration': '_Rep1' is not a valid template type argument for parameter '_Rep'
chrono(244,25): error C2923: 'std::chrono::duration': '_Period1' is not a valid template type argument for parameter '_Period'
chrono(244,74): error C2065: '_Rep2': undeclared identifier
chrono(244,81): error C2065: '_Period2': undeclared identifier
chrono(244,65): error C2923: 'std::chrono::duration': '_Rep2' is not a valid template type argument for parameter '_Rep'
chrono(244,65): error C2923: 'std::chrono::duration': '_Period2' is not a valid template type argument for parameter '_Period'
chrono(245,81): error C2143: syntax error: missing ';' before '{'
chrono(245,81): error C2447: '{': missing function header (old-style formal list?)
chrono(251,39): error C2988: unrecognizable template declaration/definition
chrono(251,39): error C2143: syntax error: missing ';' before '<'
chrono(251,16): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
chrono(251,26): error C2374: 'std::chrono::common_type_t': redefinition; multiple initialization
chrono(243): message : see declaration of 'std::chrono::common_type_t'
chrono(251,39): error C2059: syntax error: '<'
chrono(251,49): error C2065: '_Rep1': undeclared identifier
chrono(251,56): error C2065: '_Period1': undeclared identifier
chrono(251,40): error C2923: 'std::chrono::duration': '_Rep1' is not a valid template type argument for parameter '_Rep'
chrono(251,40): error C2923: 'std::chrono::duration': '_Period1' is not a valid template type argument for parameter '_Period'
chrono(251,76): error C2065: '_Rep2': undeclared identifier
chrono(251,83): error C2065: '_Period2': undeclared identifier
chrono(251,67): error C2923: 'std::chrono::duration': '_Rep2' is not a valid template type argument for parameter '_Rep'
chrono(251,67): error C2923: 'std::chrono::duration': '_Period2' is not a valid template type argument for parameter '_Period'
chrono(252,34): error C2065: '_Rep1': undeclared identifier
chrono(252,41): error C2065: '_Period1': undeclared identifier
chrono(252,25): error C2923: 'std::chrono::duration': '_Rep1' is not a valid template type argument for parameter '_Rep'
chrono(252,25): error C2923: 'std::chrono::duration': '_Period1' is not a valid template type argument for parameter '_Period'
chrono(252,74): error C2065: '_Rep2': undeclared identifier
chrono(252,81): error C2065: '_Period2': undeclared identifier
chrono(252,1): fatal error C1003: error count exceeds 100; stopping compilation

include of any Eigen 3.3.1 files in fresh Visual Studio project won't compile

I created a fresh C++ (empty) project in VS2015, and then placed the Eigen 3.3.1 source code in an 'inc' folder in solution dir, such that the path to Matrix.h, for example, is inc/Eigen/Core/. I have set this inc/ path as an additional include directory, and have also tried with inc/Eigen/ as another include directory in case the files had issues including each other, but this changed nothing.
In main.cpp, I have the following:
#include "Eigen/Core/Matrix.h"
int main()
{
return 0;
}
This gives me, when compiling for x64:
1>c:\users\brody\documents\visual studio 2015\projects\eigentest\inc\eigen\core\matrix.h(18): error C2988: unrecognizable template declaration/definition
1>c:\users\brody\documents\visual studio 2015\projects\eigentest\inc\eigen\core\matrix.h(18): error C2143: syntax error: missing ';' before '<'
1>c:\users\brody\documents\visual studio 2015\projects\eigentest\inc\eigen\core\matrix.h(18): error C2059: syntax error: '<'
1>c:\users\brody\documents\visual studio 2015\projects\eigentest\inc\eigen\core\matrix.h(19): error C2143: syntax error: missing ';' before '{'
1>c:\users\brody\documents\visual studio 2015\projects\eigentest\inc\eigen\core\matrix.h(19): error C2447: '{': missing function header (old-style formal list?)
1>c:\users\brody\documents\visual studio 2015\projects\eigentest\inc\eigen\core\matrix.h(179): error C2143: syntax error: missing ',' before '<'
1> c:\users\brody\documents\visual studio 2015\projects\eigentest\inc\eigen\core\matrix.h(404): note: see reference to class template instantiation 'Eigen::Matrix<_Scalar,_Rows,_Cols,_Options,_MaxRows,_MaxCols>' being compiled
1>c:\users\brody\documents\visual studio 2015\projects\eigentest\inc\eigen\core\matrix.h(186): error C2143: syntax error: missing ';' before '<'
1>c:\users\brody\documents\visual studio 2015\projects\eigentest\inc\eigen\core\matrix.h(186): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\users\brody\documents\visual studio 2015\projects\eigentest\inc\eigen\core\matrix.h(186): error C2238: unexpected token(s) preceding ';'
1>c:\users\brody\documents\visual studio 2015\projects\eigentest\inc\eigen\core\matrix.h(192): error C2653: 'Base': is not a class or namespace name
1>c:\users\brody\documents\visual studio 2015\projects\eigentest\inc\eigen\core\matrix.h(192): error C2144: syntax error: 'int' should be preceded by ';'
1>c:\users\brody\documents\visual studio 2015\projects\eigentest\inc\eigen\core\matrix.h(192): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\users\brody\documents\visual studio 2015\projects\eigentest\inc\eigen\core\matrix.h(192): warning C4183: 'EIGEN_DENSE_PUBLIC_INTERFACE': missing return type; assumed to be a member function returning 'int'
1>c:\users\brody\documents\visual studio 2015\projects\eigentest\inc\eigen\core\matrix.h(192): error C3646: 'PlainObject': unknown override specifier
1>c:\users\brody\documents\visual studio 2015\projects\eigentest\inc\eigen\core\matrix.h(194): error C2653: 'Base': is not a class or namespace name
1>c:\users\brody\documents\visual studio 2015\projects\eigentest\inc\eigen\core\matrix.h(195): error C2653: 'Base': is not a class or namespace name
1>c:\users\brody\documents\visual studio 2015\projects\eigentest\inc\eigen\core\matrix.h(206): error C3646: 'EIGEN_STRONG_INLINE': unknown override specifier
1>c:\users\brody\documents\visual studio 2015\projects\eigentest\inc\eigen\core\matrix.h(206): error C3646: 'Matrix': unknown override specifier
1>c:\users\brody\documents\visual studio 2015\projects\eigentest\inc\eigen\core\matrix.h(206): error C2143: syntax error: missing ';' before '&'
1>c:\users\brody\documents\visual studio 2015\projects\eigentest\inc\eigen\core\matrix.h(206): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\users\brody\documents\visual studio 2015\projects\eigentest\inc\eigen\core\matrix.h(207): error C2334: unexpected token(s) preceding '{'; skipping apparent function body
1>c:\users\brody\documents\visual studio 2015\projects\eigentest\inc\eigen\core\matrix.h(223): error C2061: syntax error: identifier 'EIGEN_STRONG_INLINE'
1>c:\users\brody\documents\visual studio 2015\projects\eigentest\inc\eigen\core\matrix.h(237): error C2334: unexpected token(s) preceding '{'; skipping apparent function body
1>c:\users\brody\documents\visual studio 2015\projects\eigentest\inc\eigen\core\matrix.h(243): error C2061: syntax error: identifier 'EIGEN_STRONG_INLINE'
1>c:\users\brody\documents\visual studio 2015\projects\eigentest\inc\eigen\core\matrix.h(259): error C2334: unexpected token(s) preceding ':'; skipping apparent function body
1>c:\users\brody\documents\visual studio 2015\projects\eigentest\inc\eigen\core\matrix.h(14): fatal error C1075: the left brace '{' was unmatched at the end of the file
Which complains about line 18 of Matrix.h:
#ifndef EIGEN_MATRIX_H
#define EIGEN_MATRIX_H
namespace Eigen {
namespace internal {
template<typename _Scalar, int _Rows, int _Cols, int _Options, int _MaxRows, int _MaxCols>
struct traits<Matrix<_Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols> > // line 18
{
private:
// etc...
Similar issues occur with any other Eigen #include. Have I missed some required #include ordering or some compile flag or setting? Thanks!
You must copy the entire Eigen directory not just the src subfolder. And you must not include files from the src subfolder directly, but include the files in the Eigen directory. E.g., #include <Eigen/Core> will include all core functionality, #include <Eigen/Dense> will include all dense functionality (this includes Core, Geometry and the decompositions).

C++ Header file - syntax problems

I have some errors in my header file, which I don't know how to fix because I am fairly new to C++.
Here is the code of the header file:
#pragma once
typedef unsigned int uint;
class DCEncryption
{
public:
static char* manageData(char*, char*, uint);
private:
static int max(int, int);
static uint leftRotate(uint, int);
};
And here are the errors:
- dcencryption.h(12): error C2062: type 'int' unexpected
- dcencryption.h(12): error C2334: unexpected token(s) preceding ':'; skipping apparent function body
- dcencryption.h(12): error C2760: syntax error : expected '{' not ';'
- dcencryption.h(13): error C2144: syntax error : 'uint' should be preceded by '}'
- dcencryption.h(13): error C2143: syntax error : missing ')' before ';'
- dcencryption.h(13): error C2059: syntax error : ')'
- dcencryption.h(13): error C2143: syntax error : missing ';' before ')'
- dcencryption.h(13): error C2238: unexpected token(s) preceding ';'
You are probably on Windows and you have included windef.h directly or indirectly (through windows.h, maybe) from your main .cpp file before including the shown file.
It so happens that max is a macro defined in windef.h that does not expand nicely in your context.
This can quite easily happen on some other platforms as well.

BUG on boost spirit?

I'm trying to migrate my code from VSC++ 6 to VSC++ 2008 express edition and from Intel compiler to Microsoft compiler. Everything were easy to migrate except that I'm receiving this errors now:
1>------ Build started: Project: Base, Configuration: Debug Win32 ------
1>Compiling...
1>DefaultScriptReader.cpp
1>Warning: This header is deprecated. Please use: boost/spirit/include/classic.hpp
1>Warning: This header is deprecated. Please use: boost/spirit/include/classic_dynamic.hpp
1>c:\Desenvolvimento\dff_dependencies_windows\include\boost/spirit/home/classic/dynamic/lazy.hpp(33) : error C2143: syntax error : missing ';' before '<'
1> c:\Desenvolvimento\dff_dependencies_windows\include\boost/spirit/home/classic/dynamic/lazy.hpp(53) : see reference to class template instantiation 'boost::spirit::lazy_parser<ActorT>' being compiled
1>c:\Desenvolvimento\dff_dependencies_windows\include\boost/spirit/home/classic/dynamic/lazy.hpp(33) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\Desenvolvimento\dff_dependencies_windows\include\boost/spirit/home/classic/dynamic/lazy.hpp(34) : error C2238: unexpected token(s) preceding ';'
1>c:\Desenvolvimento\dff_dependencies_windows\include\boost/spirit/home/classic/dynamic/lazy.hpp(40) : error C2065: 'actor_result_t' : undeclared identifier
1> c:\Desenvolvimento\dff_dependencies_windows\include\boost/spirit/home/classic/dynamic/lazy.hpp(42) : see reference to class template instantiation 'boost::spirit::lazy_parser<ActorT>::result<ScannerT>' being compiled
1>Warning: This header is deprecated. Please use: boost/spirit/include/phoenix1.hpp
1>Warning: This header is deprecated. Please use: boost/spirit/include/classic_grammar_def.hpp
1>c:\Desenvolvimento\dff_dependencies_windows\include\boost/spirit/home/classic/utility/grammar_def.hpp(104) : error C2039: 'nil_t' : is not a member of 'boost::phoenix'
1>c:\Desenvolvimento\dff_dependencies_windows\include\boost/spirit/home/classic/utility/grammar_def.hpp(112) : error C2039: 'nil_t' : is not a member of 'boost::phoenix'
1>c:\Desenvolvimento\dff_dependencies_windows\include\boost/spirit/home/classic/utility/grammar_def.hpp(180) : error C2143: syntax error : missing ';' before '<'
1> c:\Desenvolvimento\dff_dependencies_windows\include\boost/spirit/home/classic/utility/grammar_def.hpp(299) : see reference to class template instantiation 'boost::spirit::grammar_def<T,T0,T1,T2,T3,T4,T5,T6,T7>' being compiled
1>c:\Desenvolvimento\dff_dependencies_windows\include\boost/spirit/home/classic/utility/grammar_def.hpp(180) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\Desenvolvimento\dff_dependencies_windows\include\boost/spirit/home/classic/utility/grammar_def.hpp(187) : error C2238: unexpected token(s) preceding ';'
1>c:\Desenvolvimento\dff_dependencies_windows\include\boost/spirit/home/classic/utility/grammar_def.hpp(277) : error C2143: syntax error : missing ';' before '<'
1>c:\Desenvolvimento\dff_dependencies_windows\include\boost/spirit/home/classic/utility/grammar_def.hpp(277) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\Desenvolvimento\dff_dependencies_windows\include\boost/spirit/home/classic/utility/grammar_def.hpp(277) : error C2238: unexpected token(s) preceding ';'
1>c:\Desenvolvimento\dff_dependencies_windows\include\boost/spirit/home/classic/utility/grammar_def.hpp(277) : error C2988: unrecognizable template declaration/definition
1>c:\Desenvolvimento\dff_dependencies_windows\include\boost/spirit/home/classic/utility/grammar_def.hpp(277) : error C2059: syntax error : '<'
1>c:\Desenvolvimento\dff_dependencies_windows\include\boost/spirit/home/classic/utility/grammar_def.hpp(297) : error C2334: unexpected token(s) preceding ':'; skipping apparent function body
1>c:\Desenvolvimento\dff_dependencies_windows\include\boost/spirit/home/classic/utility/grammar_def.hpp(298) : error C2760: syntax error : expected '{' not ';'
1>c:\Desenvolvimento\dff_dependencies_windows\include\boost/spirit/home/classic/utility/grammar_def.hpp(299) : fatal error C1075: end of file found before the left brace '{' at 'c:\Desenvolvimento\dff_dependencies_windows\include\boost/spirit/home/classic/utility/grammar_def.hpp(54)' was matched
1>Build log was saved at "file://c:\Desenvolvimento\DFF\VC9\Base\Debug\BuildLog.htm"
1>Base - 17 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
How you can see, the MS Compiler shows syntax errors on boost library.
I found on boost site that this compiler, version 9, is compatible to the library.
So, what is going on to my code?
The code with deprecated parts fixed:
1>------ Build started: Project: Base, Configuration: Debug Win32 ------
1>Compiling...
1>DefaultScriptReader.cpp
1>c:\Desenvolvimento\dff_dependencies_windows\include\boost/spirit/home/classic/dynamic/lazy.hpp(33) : error C2143: syntax error : missing ';' before '<'
1> c:\Desenvolvimento\dff_dependencies_windows\include\boost/spirit/home/classic/dynamic/lazy.hpp(53) : see reference to class template instantiation 'boost::spirit::classic::lazy_parser<ActorT>' being compiled
1>c:\Desenvolvimento\dff_dependencies_windows\include\boost/spirit/home/classic/dynamic/lazy.hpp(33) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\Desenvolvimento\dff_dependencies_windows\include\boost/spirit/home/classic/dynamic/lazy.hpp(34) : error C2238: unexpected token(s) preceding ';'
1>c:\Desenvolvimento\dff_dependencies_windows\include\boost/spirit/home/classic/dynamic/lazy.hpp(40) : error C2065: 'actor_result_t' : undeclared identifier
1> c:\Desenvolvimento\dff_dependencies_windows\include\boost/spirit/home/classic/dynamic/lazy.hpp(42) : see reference to class template instantiation 'boost::spirit::classic::lazy_parser<ActorT>::result<ScannerT>' being compiled
1>c:\Desenvolvimento\dff_dependencies_windows\include\boost/spirit/home/classic/utility/grammar_def.hpp(104) : error C2039: 'nil_t' : is not a member of 'boost::phoenix'
1>c:\Desenvolvimento\dff_dependencies_windows\include\boost/spirit/home/classic/utility/grammar_def.hpp(112) : error C2039: 'nil_t' : is not a member of 'boost::phoenix'
1>c:\Desenvolvimento\dff_dependencies_windows\include\boost/spirit/home/classic/utility/grammar_def.hpp(180) : error C2143: syntax error : missing ';' before '<'
1> c:\Desenvolvimento\dff_dependencies_windows\include\boost/spirit/home/classic/utility/grammar_def.hpp(299) : see reference to class template instantiation 'boost::spirit::classic::grammar_def<T,T0,T1,T2,T3,T4,T5,T6,T7>' being compiled
1>c:\Desenvolvimento\dff_dependencies_windows\include\boost/spirit/home/classic/utility/grammar_def.hpp(180) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\Desenvolvimento\dff_dependencies_windows\include\boost/spirit/home/classic/utility/grammar_def.hpp(187) : error C2238: unexpected token(s) preceding ';'
1>c:\Desenvolvimento\dff_dependencies_windows\include\boost/spirit/home/classic/utility/grammar_def.hpp(277) : error C2143: syntax error : missing ';' before '<'
1>c:\Desenvolvimento\dff_dependencies_windows\include\boost/spirit/home/classic/utility/grammar_def.hpp(277) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\Desenvolvimento\dff_dependencies_windows\include\boost/spirit/home/classic/utility/grammar_def.hpp(277) : error C2238: unexpected token(s) preceding ';'
1>c:\Desenvolvimento\dff_dependencies_windows\include\boost/spirit/home/classic/utility/grammar_def.hpp(277) : error C2988: unrecognizable template declaration/definition
1>c:\Desenvolvimento\dff_dependencies_windows\include\boost/spirit/home/classic/utility/grammar_def.hpp(277) : error C2059: syntax error : '<'
1>c:\Desenvolvimento\dff_dependencies_windows\include\boost/spirit/home/classic/utility/grammar_def.hpp(297) : error C2334: unexpected token(s) preceding ':'; skipping apparent function body
1>c:\Desenvolvimento\dff_dependencies_windows\include\boost/spirit/home/classic/utility/grammar_def.hpp(298) : error C2760: syntax error : expected '{' not ';'
1>c:\Desenvolvimento\dff_dependencies_windows\include\boost/spirit/home/classic/utility/grammar_def.hpp(299) : fatal error C1075: end of file found before the left brace '{' at 'c:\Desenvolvimento\dff_dependencies_windows\include\boost/spirit/home/classic/utility/grammar_def.hpp(56)' was matched
1>Build log was saved at "file://c:\Desenvolvimento\DFF\VC9\Base\Debug\BuildLog.htm"
1>Base - 17 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Thanks
Leandro Lima
The problem was resolved just including phoenix1. The old version of phoenix.