Spirit V1.8 to V2.1 Porting Errors

Hi, Trying to port the code to V2.1, a number of redefinition errors get generated by the compiler. The first instance is the extern InterLockedIncrement variable at line 73 of the interlocked.hpp file. The code is segmented for different platforms using #if #elif and so on directives. The project is at the same time ported from Visual Studio 2008 to 2010 RC1, and the redefinition error is caused by compiler not excluding parts of that file. The define by the Visual Studio is the _WIN32_WINNT base on the use of the 32 bit development PC. This definition is not listed by the #elif chain within the interlocked.hpp code and it seems that BOOST_USE_WINDOWS_H is used instead. Knowing the segments are coded to be mutually exclusive, still the code generates errors? Regards, Reza Bemanian

Trying to port the code to V2.1, a number of redefinition errors get generated by the compiler. The first instance is the extern InterLockedIncrement variable at line 73 of the interlocked.hpp file. The code is segmented for different platforms using #if #elif and so on directives. The project is at the same time ported from Visual Studio 2008 to 2010 RC1, and the redefinition error is caused by compiler not excluding parts of that file. The define by the Visual Studio is the _WIN32_WINNT base on the use of the 32 bit development PC. This definition is not listed by the #elif chain within the interlocked.hpp code and it seems that BOOST_USE_WINDOWS_H is used instead. Knowing the segments are coded to be mutually exclusive, still the code generates errors?
I doubt this has anything to do with Spirit as it doesn't make any use of InterLockedIncrement. AFAIR it doesn't even (directly) include windows.h. Please provide a minimal example exposing your problem, otherwise it's almost impossible to help. Regards Hartmut --------------- Meet me at BoostCon www.boostcon.com

Hi, Yes, these are the compilation errors. 2>------ Build started: Project: Project, Configuration: Debug Win32 ------ 2> ProjectFRM.cpp 2>F:Project\boost\boost/detail/interlocked.hpp(57): error C2373: '_InterlockedIncrement' : redefinition; different type modifiers 2> G:\Program Files\Microsoft Visual Studio 10.0\VC\include\intrin.h(177) : see declaration of '_InterlockedIncrement' 2>F:Project\boost\boost/detail/interlocked.hpp(58): error C2373: '_InterlockedDecrement' : redefinition; different type modifiers 2> G:\Program Files\Microsoft Visual Studio 10.0\VC\include\intrin.h(175) : see declaration of '_InterlockedDecrement' 2>F:Project\boost\boost/detail/interlocked.hpp(59): error C2373: '_InterlockedCompareExchange' : redefinition; different type modifiers 2> G:\Program Files\Microsoft Visual Studio 10.0\VC\include\intrin.h(176) : see declaration of '_InterlockedCompareExchange' 2>F:Project\boost\boost/smart_ptr/detail/sp_counted_base_w32.hpp(73): error C3861: '_InterlockedIncrement': identifier not found 2>F:Project\boost\boost/smart_ptr/detail/sp_counted_base_w32.hpp(92): error C2446: '==' : no conversion from 'long' to 'long (__clrcall *)(volatile long *,long,long)' 2>F:Project\boost\boost/smart_ptr/detail/sp_counted_base_w32.hpp(92): error C2040: '==' : 'long (__clrcall *)(volatile long *,long,long)' differs in levels of indirection from 'long' 2>F:Project\boost\boost/smart_ptr/detail/sp_counted_base_w32.hpp(92): error C3861: '_InterlockedCompareExchange': identifier not found 2>F:Project\boost\boost/smart_ptr/detail/sp_counted_base_w32.hpp(100): error C3861: '_InterlockedDecrement': identifier not found 2>F:Project\boost\boost/smart_ptr/detail/sp_counted_base_w32.hpp(109): error C3861: '_InterlockedIncrement': identifier not found 2>F:Project\boost\boost/smart_ptr/detail/sp_counted_base_w32.hpp(114): error C3861: '_InterlockedDecrement': identifier not found 2>CL : warning : This header is deprecated. Please use: boost/spirit/include/classic_ast.hpp 2>CL : warning : This header is deprecated. Please use: boost/spirit/include/classic_tree_to_xml.hpp 2> CThreads.cpp I tried to use the Spirit Classic by changing the project include and namespace statements to classic. Those are the only changes made to the project for the port. The library is stored as the complete download with the rest of the boost libraries including the smart pointer, and have not further tried to compile the code with removing such directories. Best Regards, Reza Bemanian -----Original Message----- From: boost-bounces@lists.boost.org [mailto:boost-bounces@lists.boost.org] On Behalf Of Hartmut Kaiser Sent: Thursday, February 25, 2010 10:19 AM To: boost@lists.boost.org Subject: Re: [boost] Spirit V1.8 to V2.1 Porting Errors
Trying to port the code to V2.1, a number of redefinition errors get generated by the compiler. The first instance is the extern InterLockedIncrement variable at line 73 of the interlocked.hpp file. The code is segmented for different platforms using #if #elif and so on directives. The project is at the same time ported from Visual Studio 2008 to 2010 RC1, and the redefinition error is caused by compiler not excluding parts of that file. The define by the Visual Studio is the _WIN32_WINNT base on the use of the 32 bit development PC. This definition is not listed by the #elif chain within the interlocked.hpp code and it seems that BOOST_USE_WINDOWS_H is used instead. Knowing the segments are coded to be mutually exclusive, still the code generates errors?
I doubt this has anything to do with Spirit as it doesn't make any use of InterLockedIncrement. AFAIR it doesn't even (directly) include windows.h. Please provide a minimal example exposing your problem, otherwise it's almost impossible to help. Regards Hartmut --------------- Meet me at BoostCon www.boostcon.com _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

Yes, these are the compilation errors.
2>------ Build started: Project: Project, Configuration: Debug Win32 -- ---- [snipped errors]
I tried to use the Spirit Classic by changing the project include and namespace statements to classic. Those are the only changes made to the project for the port. The library is stored as the complete download with the rest of the boost libraries including the smart pointer, and have not further tried to compile the code with removing such directories.
Ok, I have to take your word for it. But how do you think I should know what actually happens in your code if all what you're showing to me is a listing of completely unrelated (to Spirit) error messages? I have no crystal ball to see what you're doing. So I must ask you again, please provide me with a small self contained piece of code reproducing your problem. Does your code compile if you do not change the Spirit #include's (yes I know you'll see the deprecated warnings then)? What Boost versions have your code been compiled with before your changes? Regards Hartmut --------------- Meet me at BoostCon www.boostcon.com

Beside four additional deprecated warnings, the errors remain the same if the includes and namespaces were switched back to original. The version of spirit used earlier is 1.8.x written at the top of the version.h file within the spirit directory. The other changes made to the code during the port are, now the boost directory is used by its entirety outside the project directory, and not only the Spirit part within the project directory. Apparently all the set additional include paths for the change seem to work fine. The other change is switch from the VS2008 to VS2010 RC1. The code builds when the older version of the spirit is used as before, although the parsing works partially and apparently not for the entire existing grammar structure. This is the reason that I decided to switch to the new Spirit version at the same time too. Regards, Reza Bemanian -----Original Message----- From: boost-bounces@lists.boost.org [mailto:boost-bounces@lists.boost.org] On Behalf Of Hartmut Kaiser Sent: Thursday, February 25, 2010 11:54 AM To: boost@lists.boost.org Subject: Re: [boost] Spirit V1.8 to V2.1 Porting Errors
Yes, these are the compilation errors.
2>------ Build started: Project: Project, Configuration: Debug Win32 -- ---- [snipped errors]
I tried to use the Spirit Classic by changing the project include and namespace statements to classic. Those are the only changes made to the project for the port. The library is stored as the complete download with the rest of the boost libraries including the smart pointer, and have not further tried to compile the code with removing such directories.
Ok, I have to take your word for it. But how do you think I should know what actually happens in your code if all what you're showing to me is a listing of completely unrelated (to Spirit) error messages? I have no crystal ball to see what you're doing. So I must ask you again, please provide me with a small self contained piece of code reproducing your problem. Does your code compile if you do not change the Spirit #include's (yes I know you'll see the deprecated warnings then)? What Boost versions have your code been compiled with before your changes? Regards Hartmut --------------- Meet me at BoostCon www.boostcon.com _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
participants (2)
-
Alireza Bemanian
-
Hartmut Kaiser