Issues trying to use boost::unordered_map
Hi,
I am trying to use a boost::unordered_map as a member of my class. The
unordered_map is defined as,
boost::unordered_map
Hi, After some experiments, I found out that in my program if I wrote "boost::" it autocompletes but "unordered_map" does not exist in the autocomplete options. But I have included the header and I am able to navigate to the file by right clicking on the include. I also see that things that auto-complete are not causing compilation failures but ones that dont auto complete do cause problems. I am sorry if this does not have too much significance, but since this is my first time coding in Windows/Visual Studio after coding in Linux, was thinking this might be a clue to the issue. Thanks, Ram
On 28 September 2016 at 13:24, Ram
This is the compilation error I get,
x_objs.cpp c:\codeworks\common\lib\boost\boost\unordered\detail\buckets.hpp(767) : error C2059: syntax error : '('
It's a bit hard to know without context, but this appears to be the same issue you're having with multi_index in another thread. It looks like that syntax error is for the code: template<typename Type> void construct(void* p,const Type& t) { new (p) Type(t); } Here, you're getting an error for: void construct(bool which, H const& hf, P const& eq) { new((void*) &funcs_[which]) function_pair(hf, eq); } More complicated, but both are using placement new, so I guess that something in your environment is incompatible with placement new. Try building a minimal example to see if it works, for example: #include <new> int main() { int space; void* ptr = &space; new (ptr) int(); } If that works okay, try also including the headers that you use in your project to see if any of them cause it to stop working.
On 28 September 2016 at 14:33, Daniel James
It's a bit hard to know without context, but this appears to be the same issue you're having with multi_index in another thread. It looks like that syntax error is for the code:
template<typename Type> void construct(void* p,const Type& t) { new (p) Type(t); }
It might be an issue with precompiled headers. Someone solved a similar problem by turning them off: http://stackoverflow.com/a/11217268/2434
On 28 September 2016 at 14:58, Daniel James
It might be an issue with precompiled headers. Someone solved a similar problem by turning them off:
Sorry, I got that link from you. Got mixed up with other browser tabs and I thought it was from a search.
Em 28/09/2016, às 15:33, Daniel James
On 28 September 2016 at 13:24, Ram
wrote: This is the compilation error I get,
x_objs.cpp c:\codeworks\common\lib\boost\boost\unordered\detail\buckets.hpp(767) : error C2059: syntax error : '('
It's a bit hard to know without context, but this appears to be the same issue you're having with multi_index in another thread. It looks like that syntax error is for the code:
template<typename Type> void construct(void* p,const Type& t) { new (p) Type(t); }
Here, you're getting an error for:
void construct(bool which, H const& hf, P const& eq) { new((void*) &funcs_[which]) function_pair(hf, eq); }
More complicated, but both are using placement new, so I guess that something in your environment is incompatible with placement new.
Along that line, Ram, could you please verify if your project uses DEBUG_NEW somewhere? Don't forget to check for macro definitions on the project's properties window. Joaquín M López Muñoz
Hi Daniel/Joaquin, Please find my answers to your questions below, [ #include <new> int main() { int space; void* ptr = &space; new (ptr) int(); } If that works okay, try also including the headers that you use in your project to see if any of them cause it to stop working. ] Yes, a fresh project with this program works. The only new header I had to add is "boost/unordered_map.hpp". Adding that did not cause any compilation problems [ It might be an issue with precompiled headers. Someone solved a similar problem by turning them off: ] I suspected this previously, but turning this on/off did not cause any issue is stand alone programs using multi_index/unordered_map. [ Along that line, Ram, could you please verify if your project uses DEBUG_NEW somewhere? Don't forget to check for macro definitions on the project's properties window. ] I did a search for DEBUG_NEW and didnt get any results. I also saw that the only preprocessor defines we have are, WIN32 _DEBUG _CONSOLE V_DEBUG Thanks, Ram
On 29/09/2016 05:14, Ram wrote:
Along that line, Ram, could you please verify if your project uses DEBUG_NEW somewhere? Don't forget to check for macro definitions on the project's properties window.
I did a search for DEBUG_NEW and didnt get any results. I also saw that the only preprocessor defines we have are, WIN32 _DEBUG _CONSOLE V_DEBUG
As suggested in the other thread, try setting C++ -> Preprocessor -> Preprocess to a File -> Yes (/P) on the .cpp file that demonstrates the compile error, and then compile that one file. Afterwards, reset the setting to No, and then look around for a .i file that it generated with the same base name. (It's usually either next to the source file or in your obj or other intermediate directory.) Search through this file for the line that generated the error and you'll see what it really looks like to the compiler after the preprocessor has finished. This might give you some hints as to the source of the problem, which is almost certainly a #define new buried somewhere in a header file.
Hi Gavin,
[
As suggested in the other thread, try setting C++ -> Preprocessor ->
Preprocess to a File -> Yes (/P) on the .cpp file that demonstrates the
compile error, and then compile that one file.
]
Will try that and let you know Gavin! Also wanted to know if it is possible
to get the compiler error(the exact location) in my pre-processed file?
Thanks,
Ram
On Thu, Sep 29, 2016 at 5:45 AM, Gavin Lambert
On 29/09/2016 05:14, Ram wrote:
Along that line, Ram, could you please verify if your project uses
DEBUG_NEW somewhere? Don't forget to check for macro definitions on the project's properties window.
I did a search for DEBUG_NEW and didnt get any results. I also saw that the only preprocessor defines we have are, WIN32 _DEBUG _CONSOLE V_DEBUG
As suggested in the other thread, try setting C++ -> Preprocessor -> Preprocess to a File -> Yes (/P) on the .cpp file that demonstrates the compile error, and then compile that one file.
Afterwards, reset the setting to No, and then look around for a .i file that it generated with the same base name. (It's usually either next to the source file or in your obj or other intermediate directory.)
Search through this file for the line that generated the error and you'll see what it really looks like to the compiler after the preprocessor has finished. This might give you some hints as to the source of the problem, which is almost certainly a #define new buried somewhere in a header file.
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
Hi Gavin, I have my pre-processed output. I dont see anything mysterious here. Is there any specific location I would need to see? The template replacement? What would I need to search for? Thanks, Ram
Hi Gavin/Joaquin,
Since we saw the error in construct in buckets.hpp. I searched for
"construct(" in my pre-processed file. This is the template replacement,
.
.
.
template
On 29/09/2016 17:39, Ram wrote:
Will try that and let you know Gavin! Also wanted to know if it is possible to get the compiler error(the exact location) in my pre-processed file?
If you rename the .i file as a .cpp you can then add it to your project and right-click-Compile it individually. If it still shows the original line numbers then generate the .i file again but turn on the "Preprocess Suppress Line Numbers" setting as well.
Since we saw the error in construct in buckets.hpp. I searched for "construct(" in my pre-processed file. This is the template replacement, [...] template
inline void _Construct(_Ty1 *_Ptr, _Ty2&& _Val) { void *_Vptr = _Ptr; ::new (_Vptr) _Ty1(::std:: forward<_Ty2>(_Val)); } template<class _Ty1> inline void _Construct(_Ty1 *_Ptr) { void *_Vptr = _Ptr; ::new (_Vptr) _Ty1(); }
Well, it doesn't look like there's anything weird going on in there. Though if you do the above to locate exactly which line it's objecting to, it might help. Since this is C++11 code, let's go back to basics for a moment. Exactly *which* version of Visual Studio are you using? (Both the main version and which Update you've installed. You can check that in the About window.)
Mere moments ago, quoth I:
Since this is C++11 code, let's go back to basics for a moment. Exactly *which* version of Visual Studio are you using? (Both the main version and which Update you've installed. You can check that in the About window.)
Also which Boost version you're using too.
Hi Gavin, [ If you rename the .i file as a .cpp you can then add it to your project and right-click-Compile it individually. If it still shows the original line numbers then generate the .i file again but turn on the "Preprocess Suppress Line Numbers" setting as well. ] I will definitely try this right away and let you know. [ Since this is C++11 code, let's go back to basics for a moment. Exactly *which* version of Visual Studio are you using? ] I am NOT using C++11. I am using Visual Studio 2005, [image: Inline image 1] [ Also which Boost version you're using too. ] I am using boost_1_61_0. Thanks, Ram
Hi Gavin, [ If you rename the .i file as a .cpp you can then add it to your project and right-click-Compile it individually. If it still shows the original line numbers then generate the .i file again but turn on the "Preprocess Suppress Line Numbers" setting as well. ] I compiled just that one file(after making changes to log preprocessor output to file). Replaced the contents of the same file by the contents of the .i file and tried compiling again and I get lot of errors as follows. Looks like I am doing something wrong. ------ Build started: Project: Worker, Configuration: Debug Win32 ------ Compiling... cl : Command line warning D9007 : '/C' requires '/E, /EP or /P'; option ignored manager_abc.cpp c:\program files (x86)\microsoft visual studio 8\vc\include\crtdefs.h(2042) : error C2011: 'localeinfo_struct' : 'struct' type redefinition c:\program files (x86)\microsoft visual studio 8\vc\include\crtdefs.h(2042) : see declaration of 'localeinfo_struct' c:\program files (x86)\microsoft visual studio 8\vc\include\crtdefs.h(2048) : error C2011: 'tagLC_ID' : 'struct' type redefinition c:\program files (x86)\microsoft visual studio 8\vc\include\crtdefs.h(2048) : see declaration of 'tagLC_ID' c:\program files (x86)\microsoft visual studio 8\vc\include\crtdefs.h(2057) : error C2011: 'threadlocaleinfostruct' : 'struct' type redefinition c:\program files (x86)\microsoft visual studio 8\vc\include\crtdefs.h(2057) : see declaration of 'threadlocaleinfostruct' c:\program files (x86)\microsoft visual studio 8\vc\include\yvals.h(561) : error C2011: 'std::_Lockit' : 'class' type redefinition c:\program files (x86)\microsoft visual studio 8\vc\include\yvals.h(561) : see declaration of 'std::_Lockit' c:\program files (x86)\microsoft visual studio 8\vc\include\yvals.h(708) : error C2011: 'std::_Mutex' : 'class' type redefinition c:\program files (x86)\microsoft visual studio 8\vc\include\yvals.h(708) : see declaration of 'std::_Mutex' c:\program files (x86)\microsoft visual studio 8\vc\include\yvals.h(760) : error C2011: 'std::_Init_locks' : 'class' type redefinition c:\program files (x86)\microsoft visual studio 8\vc\include\yvals.h(760) : see declaration of 'std::_Init_locks' c:\program files (x86)\microsoft visual studio 8\vc\include\stdio.h(59) : error C2011: '_iobuf' : 'struct' type redefinition c:\program files (x86)\microsoft visual studio 8\vc\include\stdio.h(59) : see declaration of '_iobuf' c:\program files (x86)\microsoft visual studio 8\vc\include\stdio.h(269) : error C2995: 'char *gets_s(char (&)[_Size])' : function template has already been defined c:\program files (x86)\microsoft visual studio 8\vc\include\stdio.h(269) : see declaration of 'gets_s' c:\program files (x86)\microsoft visual studio 8\vc\include\stdio.h(307) : error C2995: 'int _snprintf_s(char (&)[_Size],size_t,const char *,...)' : function template has already been defined c:\program files (x86)\microsoft visual studio 8\vc\include\stdio.h(307) : see declaration of '_snprintf_s' c:\program files (x86)\microsoft visual studio 8\vc\include\stdio.h(309) : error C2995: 'int sprintf_s(char (&)[_Size],const char *,...)' : function template has already been defined c:\program files (x86)\microsoft visual studio 8\vc\include\stdio.h(309) : see declaration of 'sprintf_s' c:\program files (x86)\microsoft visual studio 8\vc\include\stdio.h(326) : error C2995: 'errno_t tmpnam_s(char (&)[_Size])' : function template has already been defined c:\program files (x86)\microsoft visual studio 8\vc\include\stdio.h(326) : see declaration of 'tmpnam_s' c:\program files (x86)\microsoft visual studio 8\vc\include\stdio.h(336) : error C2995: 'int _vsnprintf_s(char (&)[_Size],size_t,const char *,va_list)' : function template has already been defined c:\program files (x86)\microsoft visual studio 8\vc\include\stdio.h(336) : see declaration of '_vsnprintf_s' c:\program files (x86)\microsoft visual studio 8\vc\include\stdio.h(342) : error C2995: 'int vsprintf_s(char (&)[_Size],const char *,va_list)' : function template has already been defined c:\program files (x86)\microsoft visual studio 8\vc\include\stdio.h(342) : see declaration of 'vsprintf_s' c:\program files (x86)\microsoft visual studio 8\vc\include\stdio.h(422) : error C2995: 'wchar_t *_getws_s(wchar_t (&)[_Size])' : function template has already been defined c:\program files (x86)\microsoft visual studio 8\vc\include\stdio.h(422) : see declaration of '_getws_s' c:\program files (x86)\microsoft visual studio 8\vc\include\stdio.h(437) : error C2995: 'int swprintf_s(wchar_t (&)[_Size],const wchar_t *,...)' : function template has already been defined c:\program files (x86)\microsoft visual studio 8\vc\include\stdio.h(437) : see declaration of 'swprintf_s' c:\program files (x86)\microsoft visual studio 8\vc\include\stdio.h(439) : error C2995: 'int vswprintf_s(wchar_t (&)[_Size],const wchar_t *,va_list)' : function template has already been defined c:\program files (x86)\microsoft visual studio 8\vc\include\stdio.h(439) : see declaration of 'vswprintf_s' c:\program files (x86)\microsoft visual studio 8\vc\include\stdio.h(445) : error C2995: 'int _snwprintf_s(wchar_t (&)[_Size],size_t,const wchar_t *,...)' : function template has already been defined c:\program files (x86)\microsoft visual studio 8\vc\include\stdio.h(445) : see declaration of '_snwprintf_s' c:\program files (x86)\microsoft visual studio 8\vc\include\stdio.h(447) : error C2995: 'int _vsnwprintf_s(wchar_t (&)[_Size],size_t,const wchar_t *,va_list)' : function template has already been defined c:\program files (x86)\microsoft visual studio 8\vc\include\stdio.h(447) : see declaration of '_vsnwprintf_s' c:\program files (x86)\microsoft visual studio 8\vc\include\swprintf.inl(37) : error C2084: function 'int swprintf(wchar_t *,size_t,const wchar_t *,...)' already has a body c:\program files (x86)\microsoft visual studio 8\vc\include\swprintf.inl(36) : see previous definition of 'swprintf' c:\program files (x86)\microsoft visual studio 8\vc\include\swprintf.inl(50) : error C2084: function 'int vswprintf(wchar_t *,size_t,const wchar_t *,va_list)' already has a body c:\program files (x86)\microsoft visual studio 8\vc\include\swprintf.inl(49) : see previous definition of 'vswprintf' c:\program files (x86)\microsoft visual studio 8\vc\include\swprintf.inl(61) : error C2084: function 'int _swprintf_l(wchar_t *,size_t,const wchar_t *,_locale_t,...)' already has a body c:\program files (x86)\microsoft visual studio 8\vc\include\swprintf.inl(60) : see previous definition of '_swprintf_l' c:\program files (x86)\microsoft visual studio 8\vc\include\swprintf.inl(74) : error C2084: function 'int _vswprintf_l(wchar_t *,size_t,const wchar_t *,_locale_t,va_list)' already has a body c:\program files (x86)\microsoft visual studio 8\vc\include\swprintf.inl(73) : see previous definition of '_vswprintf_l' c:\program files (x86)\microsoft visual studio 8\vc\include\swprintf.inl(86) : error C2084: function 'int swprintf(wchar_t *,const wchar_t *,...)' already has a body c:\program files (x86)\microsoft visual studio 8\vc\include\swprintf.inl(85) : see previous definition of 'swprintf' c:\program files (x86)\microsoft visual studio 8\vc\include\swprintf.inl(98) : error C2084: function 'int vswprintf(wchar_t *,const wchar_t *,va_list)' already has a body c:\program files (x86)\microsoft visual studio 8\vc\include\swprintf.inl(97) : see previous definition of 'vswprintf' c:\program files (x86)\microsoft visual studio 8\vc\include\swprintf.inl(106) : error C2084: function 'int _swprintf_l(wchar_t *,const wchar_t *,_locale_t,...)' already has a body c:\program files (x86)\microsoft visual studio 8\vc\include\swprintf.inl(105) : see previous definition of '_swprintf_l' c:\program files (x86)\microsoft visual studio 8\vc\include\swprintf.inl(118) : error C2084: function 'int _vswprintf_l(wchar_t *,const wchar_t *,_locale_t,va_list)' already has a body c:\program files (x86)\microsoft visual studio 8\vc\include\swprintf.inl(117) : see previous definition of '_vswprintf_l' c:\program files (x86)\microsoft visual studio 8\vc\include\stdio.h(572) : error C2995: 'errno_t _wtmpnam_s(wchar_t (&)[_Size])' : function template has already been defined c:\program files (x86)\microsoft visual studio 8\vc\include\stdio.h(572) : see declaration of '_wtmpnam_s' c:\program files (x86)\microsoft visual studio 8\vc\include\stdio.h(586) : error C2084: function 'wint_t getwchar(void)' already has a body c:\program files (x86)\microsoft visual studio 8\vc\include\stdio.h(414) : see previous definition of 'getwchar' c:\program files (x86)\microsoft visual studio 8\vc\include\stdio.h(588) : error C2084: function 'wint_t putwchar(wchar_t)' already has a body c:\program files (x86)\microsoft visual studio 8\vc\include\stdio.h(416) : see previous definition of 'putwchar' c:\program files (x86)\microsoft visual studio 8\vc\include\string.h(68) : error C2995: 'errno_t _strset_s(char (&)[_Size],int)' : function template has already been defined c:\program files (x86)\microsoft visual studio 8\vc\include\string.h(68) : see declaration of '_strset_s' c:\program files (x86)\microsoft visual studio 8\vc\include\string.h(73) : error C2995: 'errno_t strcpy_s(char (&)[_Size],const char *)' : function template has already been defined c:\program files (x86)\microsoft visual studio 8\vc\include\string.h(73) : see declaration of 'strcpy_s' c:\program files (x86)\microsoft visual studio 8\vc\include\string.h(78) : error C2995: 'errno_t strcat_s(char (&)[_Size],const char *)' : function template has already been defined c:\program files (x86)\microsoft visual studio 8\vc\include\string.h(78) : see declaration of 'strcat_s' c:\program files (x86)\microsoft visual studio 8\vc\include\string.h(85) : error C2084: function 'size_t strnlen_s(const char *,size_t)' already has a body c:\program files (x86)\microsoft visual studio 8\vc\include\string.h(84) : see previous definition of 'strnlen_s' c:\program files (x86)\microsoft visual studio 8\vc\include\string.h(125) : error C2995: 'errno_t _strerror_s(char (&)[_Size],const char *)' : function template has already been defined c:\program files (x86)\microsoft visual studio 8\vc\include\string.h(125) : see declaration of '_strerror_s' c:\program files (x86)\microsoft visual studio 8\vc\include\string.h(130) : error C2995: 'errno_t strerror_s(char (&)[_Size],int)' : function template has already been defined c:\program files (x86)\microsoft visual studio 8\vc\include\string.h(130) : see declaration of 'strerror_s' c:\program files (x86)\microsoft visual studio 8\vc\include\string.h(132) : error C2995: 'errno_t _strlwr_s(char (&)[_Size])' : function template has already been defined c:\program files (x86)\microsoft visual studio 8\vc\include\string.h(132) : see declaration of '_strlwr_s' c:\program files (x86)\microsoft visual studio 8\vc\include\string.h(135) : error C2995: 'errno_t _strlwr_s_l(char (&)[_Size],_locale_t)' : function template has already been defined c:\program files (x86)\microsoft visual studio 8\vc\include\string.h(135) : see declaration of '_strlwr_s_l' c:\program files (x86)\microsoft visual studio 8\vc\include\string.h(140) : error C2995: 'errno_t strncat_s(char (&)[_Size],const char *,size_t)' : function template has already been defined c:\program files (x86)\microsoft visual studio 8\vc\include\string.h(140) : see declaration of 'strncat_s' c:\program files (x86)\microsoft visual studio 8\vc\include\string.h(156) : error C2995: 'errno_t strncpy_s(char (&)[_Size],const char *,size_t)' : function template has already been defined c:\program files (x86)\microsoft visual studio 8\vc\include\string.h(156) : see declaration of 'strncpy_s' c:\program files (x86)\microsoft visual studio 8\vc\include\string.h(159) : error C2995: 'errno_t _strnset_s(char (&)[_Size],int,size_t)' : function template has already been defined c:\program files (x86)\microsoft visual studio 8\vc\include\string.h(159) : see declaration of '_strnset_s' c:\program files (x86)\microsoft visual studio 8\vc\include\string.h(171) : error C2995: 'errno_t _strupr_s(char (&)[_Size])' : function template has already been defined c:\program files (x86)\microsoft visual studio 8\vc\include\string.h(171) : see declaration of '_strupr_s' c:\program files (x86)\microsoft visual studio 8\vc\include\string.h(174) : error C2995: 'errno_t _strupr_s_l(char (&)[_Size],_locale_t)' : function template has already been defined c:\program files (x86)\microsoft visual studio 8\vc\include\string.h(174) : see declaration of '_strupr_s_l' c:\program files (x86)\microsoft visual studio 8\vc\include\string.h(184) : error C2084: function 'char *strchr(char *,int)' already has a body c:\program files (x86)\microsoft visual studio 8\vc\include\string.h(183) : see previous definition of 'strchr' c:\program files (x86)\microsoft visual studio 8\vc\include\string.h(186) : error C2084: function 'char *strpbrk(char *,const char *)' already has a body c:\program files (x86)\microsoft visual studio 8\vc\include\string.h(185) : see previous definition of 'strpbrk' c:\program files (x86)\microsoft visual studio 8\vc\include\string.h(188) : error C2084: function 'char *strrchr(char *,int)' already has a body c:\program files (x86)\microsoft visual studio 8\vc\include\string.h(187) : see previous definition of 'strrchr' c:\program files (x86)\microsoft visual studio 8\vc\include\string.h(190) : error C2084: function 'char *strstr(char *,const char *)' already has a body c:\program files (x86)\microsoft visual studio 8\vc\include\string.h(189) : see previous definition of 'strstr' c:\program files (x86)\microsoft visual studio 8\vc\include\string.h(195) : error C2084: function 'void *memchr(void *,int,size_t)' already has a body c:\program files (x86)\microsoft visual studio 8\vc\include\string.h(194) : see previous definition of 'memchr' c:\program files (x86)\microsoft visual studio 8\vc\include\string.h(244) : error C2995: 'errno_t wcscat_s(wchar_t (&)[_Size],const wchar_t *)' : function template has already been defined c:\program files (x86)\microsoft visual studio 8\vc\include\string.h(244) : see declaration of 'wcscat_s' c:\program files (x86)\microsoft visual studio 8\vc\include\string.h(251) : error C2995: 'errno_t wcscpy_s(wchar_t (&)[_Size],const wchar_t *)' : function template has already been defined c:\program files (x86)\microsoft visual studio 8\vc\include\string.h(251) : see declaration of 'wcscpy_s' c:\program files (x86)\microsoft visual studio 8\vc\include\string.h(258) : error C2084: function 'size_t wcsnlen_s(const wchar_t *,size_t)' already has a body c:\program files (x86)\microsoft visual studio 8\vc\include\string.h(257) : see previous definition of 'wcsnlen_s' c:\program files (x86)\microsoft visual studio 8\vc\include\string.h(265) : error C2995: 'errno_t wcsncat_s(wchar_t (&)[_Size],const wchar_t *,size_t)' : function template has already been defined c:\program files (x86)\microsoft visual studio 8\vc\include\string.h(265) : see declaration of 'wcsncat_s' c:\program files (x86)\microsoft visual studio 8\vc\include\string.h(271) : error C2995: 'errno_t wcsncpy_s(wchar_t (&)[_Size],const wchar_t *,size_t)' : function template has already been defined c:\program files (x86)\microsoft visual studio 8\vc\include\string.h(271) : see declaration of 'wcsncpy_s' c:\program files (x86)\microsoft visual studio 8\vc\include\string.h(281) : error C2995: 'errno_t _wcserror_s(wchar_t (&)[_Size],int)' : function template has already been defined c:\program files (x86)\microsoft visual studio 8\vc\include\string.h(281) : see declaration of '_wcserror_s' c:\program files (x86)\microsoft visual studio 8\vc\include\string.h(284) : error C2995: 'errno_t __wcserror_s(wchar_t (&)[_Size],const wchar_t *)' : function template has already been defined c:\program files (x86)\microsoft visual studio 8\vc\include\string.h(284) : see declaration of '__wcserror_s' c:\program files (x86)\microsoft visual studio 8\vc\include\string.h(291) : error C2995: 'errno_t _wcsnset_s(wchar_t (&)[_Size],wchar_t,size_t)' : function template has already been defined c:\program files (x86)\microsoft visual studio 8\vc\include\string.h(291) : see declaration of '_wcsnset_s' c:\program files (x86)\microsoft visual studio 8\vc\include\string.h(295) : error C2995: 'errno_t _wcsset_s(wchar_t (&)[_Size],wchar_t)' : function template has already been defined c:\program files (x86)\microsoft visual studio 8\vc\include\string.h(295) : see declaration of '_wcsset_s' c:\program files (x86)\microsoft visual studio 8\vc\include\string.h(299) : error C2995: 'errno_t _wcslwr_s(wchar_t (&)[_Size])' : function template has already been defined c:\program files (x86)\microsoft visual studio 8\vc\include\string.h(299) : see declaration of '_wcslwr_s' c:\program files (x86)\microsoft visual studio 8\vc\include\string.h(302) : error C2995: 'errno_t _wcslwr_s_l(wchar_t (&)[_Size],_locale_t)' : function template has already been defined c:\program files (x86)\microsoft visual studio 8\vc\include\string.h(302) : see declaration of '_wcslwr_s_l' c:\program files (x86)\microsoft visual studio 8\vc\include\string.h(305) : error C2995: 'errno_t _wcsupr_s(wchar_t (&)[_Size])' : function template has already been defined c:\program files (x86)\microsoft visual studio 8\vc\include\string.h(305) : see declaration of '_wcsupr_s' c:\program files (x86)\microsoft visual studio 8\vc\include\string.h(308) : error C2995: 'errno_t _wcsupr_s_l(wchar_t (&)[_Size],_locale_t)' : function template has already been defined c:\program files (x86)\microsoft visual studio 8\vc\include\string.h(308) : see declaration of '_wcsupr_s_l' c:\program files (x86)\microsoft visual studio 8\vc\include\string.h(326) : error C2084: function 'wchar_t *wcschr(wchar_t *,wchar_t)' already has a body c:\program files (x86)\microsoft visual studio 8\vc\include\string.h(325) : see previous definition of 'wcschr' c:\program files (x86)\microsoft visual studio 8\vc\include\string.h(328) : error C2084: function 'wchar_t *wcspbrk(wchar_t *,const wchar_t *)' already has a body c:\program files (x86)\microsoft visual studio 8\vc\include\string.h(327) : see previous definition of 'wcspbrk' c:\program files (x86)\microsoft visual studio 8\vc\include\string.h(330) : error C2084: function 'wchar_t *wcsrchr(wchar_t *,wchar_t)' already has a body c:\program files (x86)\microsoft visual studio 8\vc\include\string.h(329) : see previous definition of 'wcsrchr' c:\program files (x86)\microsoft visual studio 8\vc\include\string.h(332) : error C2084: function 'wchar_t *wcsstr(wchar_t *,const wchar_t *)' already has a body c:\program files (x86)\microsoft visual studio 8\vc\include\string.h(331) : see previous definition of 'wcsstr' c:\program files (x86)\microsoft visual studio 8\vc\include\wchar.h(94) : error C2011: '_wfinddata32_t' : 'struct' type redefinition c:\program files (x86)\microsoft visual studio 8\vc\include\wchar.h(94) : see declaration of '_wfinddata32_t' c:\program files (x86)\microsoft visual studio 8\vc\include\wchar.h(105) : error C2011: '_wfinddata32i64_t' : 'struct' type redefinition c:\program files (x86)\microsoft visual studio 8\vc\include\wchar.h(105) : see declaration of '_wfinddata32i64_t' c:\program files (x86)\microsoft visual studio 8\vc\include\wchar.h(114) : error C2011: '_wfinddata64i32_t' : 'struct' type redefinition c:\program files (x86)\microsoft visual studio 8\vc\include\wchar.h(114) : see declaration of '_wfinddata64i32_t' c:\program files (x86)\microsoft visual studio 8\vc\include\wchar.h(123) : error C2011: '_wfinddata64_t' : 'struct' type redefinition c:\program files (x86)\microsoft visual studio 8\vc\include\wchar.h(123) : see declaration of '_wfinddata64_t' c:\program files (x86)\microsoft visual studio 8\vc\include\wchar.h(272) : error C2059: syntax error : '(' c:\program files (x86)\microsoft visual studio 8\vc\include\wchar.h(273) : error C2059: syntax error : '(' c:\program files (x86)\microsoft visual studio 8\vc\include\wchar.h(274) : error C2059: syntax error : '(' c:\program files (x86)\microsoft visual studio 8\vc\include\wchar.h(275) : error C2059: syntax error : '(' c:\program files (x86)\microsoft visual studio 8\vc\include\wchar.h(323) : error C2995: 'errno_t _wmktemp_s(wchar_t (&)[_Size])' : function template has already been defined c:\program files (x86)\microsoft visual studio 8\vc\include\wchar.h(323) : see declaration of '_wmktemp_s' c:\program files (x86)\microsoft visual studio 8\vc\include\wchar.h(345) : error C2572: '_wopen' : redefinition of default parameter : parameter 3 c:\program files (x86)\microsoft visual studio 8\vc\include\wchar.h(345) : see declaration of '_wopen' c:\program files (x86)\microsoft visual studio 8\vc\include\wchar.h(346) : error C2572: '_wsopen' : redefinition of default parameter : parameter 4 c:\program files (x86)\microsoft visual studio 8\vc\include\wchar.h(346) : see declaration of '_wsopen' c:\program files (x86)\microsoft visual studio 8\vc\include\wchar.h(492) : error C2011: '_stat32' : 'struct' type redefinition c:\program files (x86)\microsoft visual studio 8\vc\include\wchar.h(492) : see declaration of '_stat32' c:\program files (x86)\microsoft visual studio 8\vc\include\wchar.h(508) : error C2011: 'stat' : 'struct' type redefinition c:\program files (x86)\microsoft visual studio 8\vc\include\wchar.h(508) : see declaration of 'stat' c:\program files (x86)\microsoft visual studio 8\vc\include\wchar.h(526) : error C2011: '_stat32i64' : 'struct' type redefinition c:\program files (x86)\microsoft visual studio 8\vc\include\wchar.h(526) : see declaration of '_stat32i64' c:\program files (x86)\microsoft visual studio 8\vc\include\wchar.h(540) : error C2011: '_stat64i32' : 'struct' type redefinition c:\program files (x86)\microsoft visual studio 8\vc\include\wchar.h(540) : see declaration of '_stat64i32' c:\program files (x86)\microsoft visual studio 8\vc\include\wchar.h(554) : error C2011: '_stat64' : 'struct' type redefinition c:\program files (x86)\microsoft visual studio 8\vc\include\wchar.h(554) : see declaration of '_stat64' c:\program files (x86)\microsoft visual studio 8\vc\include\wchar.h(625) : error C2995: 'errno_t _cgetws_s(wchar_t (&)[_Size],size_t *)' : function template has already been defined c:\program files (x86)\microsoft visual studio 8\vc\include\wchar.h(625) : see declaration of '_cgetws_s' c:\program files (x86)\microsoft visual studio 8\vc\include\wchar.h(877) : error C2995: 'errno_t _itow_s(int,wchar_t (&)[_Size],int)' : function template has already been defined c:\program files (x86)\microsoft visual studio 8\vc\include\wchar.h(877) : see declaration of '_itow_s' c:\program files (x86)\microsoft visual studio 8\vc\include\wchar.h(880) : error C2995: 'errno_t _ltow_s(long,wchar_t (&)[_Size],int)' : function template has already been defined c:\program files (x86)\microsoft visual studio 8\vc\include\wchar.h(880) : see declaration of '_ltow_s' c:\program files (x86)\microsoft visual studio 8\vc\include\wchar.h(883) : error C2995: 'errno_t _ultow_s(unsigned long,wchar_t (&)[_Size],int)' : function template has already been defined c:\program files (x86)\microsoft visual studio 8\vc\include\wchar.h(883) : see declaration of '_ultow_s' c:\program files (x86)\microsoft visual studio 8\vc\include\wchar.h(893) : error C2995: 'errno_t _wgetenv_s(size_t *,wchar_t (&)[_Size],const wchar_t *)' : function template has already been defined c:\program files (x86)\microsoft visual studio 8\vc\include\wchar.h(893) : see declaration of '_wgetenv_s' c:\program files (x86)\microsoft visual studio 8\vc\include\wchar.h(951) : error C2995: 'errno_t _wmakepath_s(wchar_t (&)[_Size],const wchar_t *,const wchar_t *,const wchar_t *,const wchar_t *)' : function template has already been defined c:\program files (x86)\microsoft visual studio 8\vc\include\wchar.h(951) : see declaration of '_wmakepath_s' c:\program files (x86)\microsoft visual studio 8\vc\include\wchar.h(960) : error C2995: 'errno_t _wsearchenv_s(const wchar_t *,const wchar_t *,wchar_t (&)[_Size])' : function template has already been defined c:\program files (x86)\microsoft visual studio 8\vc\include\wchar.h(960) : see declaration of '_wsearchenv_s' c:\program files (x86)\microsoft visual studio 8\vc\include\wchar.h(968) : error C2995: 'errno_t _wsplitpath_s(const wchar_t *,wchar_t (&)[_DriveSize],wchar_t (&)[_DirSize],wchar_t (&)[_NameSize],wchar_t (&)[_ExtSize])' : function template has already been defined c:\program files (x86)\microsoft visual studio 8\vc\include\wchar.h(968) : see declaration of '_wsplitpath_s' c:\program files (x86)\microsoft visual studio 8\vc\include\wchar.h(1119) : error C2011: 'tm' : 'struct' type redefinition c:\program files (x86)\microsoft visual studio 8\vc\include\wchar.h(1119) : see declaration of 'tm' c:\program files (x86)\microsoft visual studio 8\vc\include\wchar.h(1139) : error C2995: 'errno_t _wasctime_s(wchar_t (&)[_Size],const tm *)' : function template has already been defined c:\program files (x86)\microsoft visual studio 8\vc\include\wchar.h(1139) : see declaration of '_wasctime_s' c:\program files (x86)\microsoft visual studio 8\vc\include\wchar.h(1143) : error C2995: 'errno_t _wctime32_s(wchar_t (&)[_Size],const __time32_t *)' : function template has already been defined c:\program files (x86)\microsoft visual studio 8\vc\include\wchar.h(1143) : see declaration of '_wctime32_s' c:\program files (x86)\microsoft visual studio 8\vc\include\wchar.h(1149) : error C2995: 'errno_t _wstrdate_s(wchar_t (&)[_Size])' : function template has already been defined c:\program files (x86)\microsoft visual studio 8\vc\include\wchar.h(1149) : see declaration of '_wstrdate_s' c:\program files (x86)\microsoft visual studio 8\vc\include\wchar.h(1153) : error C2995: 'errno_t _wstrtime_s(wchar_t (&)[_Size])' : function template has already been defined c:\program files (x86)\microsoft visual studio 8\vc\include\wchar.h(1153) : see declaration of '_wstrtime_s' c:\program files (x86)\microsoft visual studio 8\vc\include\wchar.h(1159) : error C2995: 'errno_t _wctime64_s(wchar_t (&)[_Size],const __time64_t *)' : function template has already been defined c:\program files (x86)\microsoft visual studio 8\vc\include\wchar.h(1159) : see declaration of '_wctime64_s' c:\program files (x86)\microsoft visual studio 8\vc\include\wtime.inl(47) : error C2084: function 'wchar_t *_wctime(const time_t *)' already has a body c:\program files (x86)\microsoft visual studio 8\vc\include\wtime.inl(46) : see previous definition of '_wctime' c:\program files (x86)\microsoft visual studio 8\vc\include\wtime.inl(55) : error C2084: function 'errno_t _wctime_s(wchar_t *,size_t,const time_t *)' already has a body c:\program files (x86)\microsoft visual studio 8\vc\include\wtime.inl(54) : see previous definition of '_wctime_s' c:\program files (x86)\microsoft visual studio 8\vc\include\wchar.h(1179) : error C2995: 'errno_t mbsrtowcs_s(size_t *,wchar_t (&)[_Size],const char **,size_t,mbstate_t *)' : function template has already been defined c:\program files (x86)\microsoft visual studio 8\vc\include\wchar.h(1179) : see declaration of 'mbsrtowcs_s' c:\program files (x86)\microsoft visual studio 8\vc\include\wchar.h(1184) : error C2995: 'errno_t wcrtomb_s(size_t *,char (&)[_Size],wchar_t,mbstate_t *)' : function template has already been defined c:\program files (x86)\microsoft visual studio 8\vc\include\wchar.h(1184) : see declaration of 'wcrtomb_s' c:\program files (x86)\microsoft visual studio 8\vc\include\wchar.h(1188) : error C2995: 'errno_t wcsrtombs_s(size_t *,char (&)[_Size],const wchar_t **,size_t,mbstate_t *)' : function template has already been defined c:\program files (x86)\microsoft visual studio 8\vc\include\wchar.h(1188) : see declaration of 'wcsrtombs_s' c:\program files (x86)\microsoft visual studio 8\vc\include\wchar.h(1206) : error C2084: function 'int fwide(FILE *,int)' already has a body c:\program files (x86)\microsoft visual studio 8\vc\include\wchar.h(1205) : see previous definition of 'fwide' c:\program files (x86)\microsoft visual studio 8\vc\include\wchar.h(1208) : error C2084: function 'int mbsinit(const mbstate_t *)' already has a body c:\program files (x86)\microsoft visual studio 8\vc\include\wchar.h(1207) : see previous definition of 'mbsinit' c:\program files (x86)\microsoft visual studio 8\vc\include\wchar.h(1208) : fatal error C1003: error count exceeds 100; stopping compilation Build log was saved at "file://c:\codeworks\build\bin\server\win\Debug\obj\BuildLog.htm" Worker - 102 error(s), 1 warning(s) ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ========== Thanks, Ram
Hi Gavin,
I guess my previous mail didnt reach you due to its size. Here it is,
"
Hi Gavin,
[
If you rename the .i file as a .cpp you can then add it to your project and
right-click-Compile it individually. If it still shows the original line
numbers then generate the .i file again but turn on the "Preprocess
Suppress Line Numbers" setting as well.
]
I will definitely try this right away and let you know.
[
Since this is C++11 code, let's go back to basics for a moment. Exactly
*which* version of Visual Studio are you using?
]
I am NOT using C++11. I am using Visual Studio 2005,
Microsoft Visual Studio 2005
Version 8.0.50727.867 (vsvista.050727-8600)
[
Also which Boost version you're using too.
]
I am using boost_1_61_0.
Thanks,
Ram
On Thu, Sep 29, 2016 at 1:37 PM, Ram
Hi Gavin,
[ If you rename the .i file as a .cpp you can then add it to your project and right-click-Compile it individually. If it still shows the original line numbers then generate the .i file again but turn on the "Preprocess Suppress Line Numbers" setting as well. ] I compiled just that one file(after making changes to log preprocessor output to file). Replaced the contents of the same file by the contents of the .i file and tried compiling again and I get lot of errors as follows. Looks like I am doing something wrong.
------ Build started: Project: Worker, Configuration: Debug Win32 ------ Compiling... cl : Command line warning D9007 : '/C' requires '/E, /EP or /P'; option ignored manager_abc.cpp c:\program files (x86)\microsoft visual studio 8\vc\include\crtdefs.h(2042) : error C2011: 'localeinfo_struct' : 'struct' type redefinition c:\program files (x86)\microsoft visual studio 8\vc\include\crtdefs.h(2042) : see declaration of 'localeinfo_struct' c:\program files (x86)\microsoft visual studio 8\vc\include\crtdefs.h(2048) : error C2011: 'tagLC_ID' : 'struct' type redefinition c:\program files (x86)\microsoft visual studio 8\vc\include\crtdefs.h(2048) : see declaration of 'tagLC_ID' c:\program files (x86)\microsoft visual studio 8\vc\include\crtdefs.h(2057) : error C2011: 'threadlocaleinfostruct' : 'struct' type redefinition c:\program files (x86)\microsoft visual studio 8\vc\include\crtdefs.h(2057) : see declaration of 'threadlocaleinfostruct' c:\program files (x86)\microsoft visual studio 8\vc\include\yvals.h(561) : error C2011: 'std::_Lockit' : 'class' type redefinition c:\program files (x86)\microsoft visual studio 8\vc\include\yvals.h(561) : see declaration of 'std::_Lockit' c:\program files (x86)\microsoft visual studio 8\vc\include\yvals.h(708) : error C2011: 'std::_Mutex' : 'class' type redefinition c:\program files (x86)\microsoft visual studio 8\vc\include\yvals.h(708) : see declaration of 'std::_Mutex' c:\program files (x86)\microsoft visual studio 8\vc\include\yvals.h(760) : error C2011: 'std::_Init_locks' : 'class' type redefinition c:\program files (x86)\microsoft visual studio 8\vc\include\yvals.h(760) : see declaration of 'std::_Init_locks' c:\program files (x86)\microsoft visual studio 8\vc\include\stdio.h(59) : error C2011: '_iobuf' : 'struct' type redefinition c:\program files (x86)\microsoft visual studio 8\vc\include\stdio.h(59) : see declaration of '_iobuf' c:\program files (x86)\microsoft visual studio 8\vc\include\stdio.h(269) : error C2995: 'char *gets_s(char (&)[_Size])' : function template has already been defined c:\program files (x86)\microsoft visual studio 8\vc\include\stdio.h(269) : see declaration of 'gets_s' c:\program files (x86)\microsoft visual studio 8\vc\include\stdio.h(307) : error C2995: 'int _snprintf_s(char (&)[_Size],size_t,const char *,...)' : function template has already been defined c:\program files (x86)\microsoft visual studio 8\vc\include\stdio.h(307) : see declaration of '_snprintf_s' c:\program files (x86)\microsoft visual studio 8\vc\include\stdio.h(309) : error C2995: 'int sprintf_s(char (&)[_Size],const char *,...)' : function template has already been defined c:\program files (x86)\microsoft visual studio 8\vc\include\stdio.h(309) : see declaration of 'sprintf_s' c:\program files (x86)\microsoft visual studio 8\vc\include\stdio.h(326) : error C2995: 'errno_t tmpnam_s(char (&)[_Size])' : function template has already been defined c:\program files (x86)\microsoft visual studio 8\vc\include\stdio.h(326) : see declaration of 'tmpnam_s' c:\program files (x86)\microsoft visual studio 8\vc\include\stdio.h(336) : error C2995: 'int _vsnprintf_s(char (&)[_Size],size_t,const char *,va_list)' : function template has already been defined c:\program files (x86)\microsoft visual studio 8\vc\include\stdio.h(336) : see declaration of '_vsnprintf_s' c:\program files (x86)\microsoft visual studio 8\vc\include\stdio.h(342) : error C2995: 'int vsprintf_s(char (&)[_Size],const char *,va_list)' : function template has already been defined c:\program files (x86)\microsoft visual studio 8\vc\include\stdio.h(342) : see declaration of 'vsprintf_s' c:\program files (x86)\microsoft visual studio 8\vc\include\stdio.h(422) : error C2995: 'wchar_t *_getws_s(wchar_t (&)[_Size])' : function template has already been defined c:\program files (x86)\microsoft visual studio 8\vc\include\stdio.h(422) : see declaration of '_getws_s' c:\program files (x86)\microsoft visual studio 8\vc\include\stdio.h(437) : error C2995: 'int swprintf_s(wchar_t (&)[_Size],const wchar_t *,...)' : function template has already been defined c:\program files (x86)\microsoft visual studio 8\vc\include\stdio.h(437) : see declaration of 'swprintf_s' c:\program files (x86)\microsoft visual studio 8\vc\include\stdio.h(439) : error C2995: 'int vswprintf_s(wchar_t (&)[_Size],const wchar_t *,va_list)' : function template has already been defined c:\program files (x86)\microsoft visual studio 8\vc\include\stdio.h(439) : see declaration of 'vswprintf_s' c:\program files (x86)\microsoft visual studio 8\vc\include\stdio.h(445) : error C2995: 'int _snwprintf_s(wchar_t (&)[_Size],size_t,const wchar_t *,...)' : function template has already been defined c:\program files (x86)\microsoft visual studio 8\vc\include\stdio.h(445) : see declaration of '_snwprintf_s' c:\program files (x86)\microsoft visual studio 8\vc\include\stdio.h(447) : error C2995: 'int _vsnwprintf_s(wchar_t (&)[_Size],size_t,const wchar_t *,va_list)' : function template has already been defined c:\program files (x86)\microsoft visual studio 8\vc\include\stdio.h(447) : see declaration of '_vsnwprintf_s' c:\program files (x86)\microsoft visual studio 8\vc\include\swprintf.inl(37) : error C2084: function 'int swprintf(wchar_t *,size_t,const wchar_t *,...)' already has a body c:\program files (x86)\microsoft visual studio 8\vc\include\swprintf.inl(36) : see previous definition of 'swprintf' c:\program files (x86)\microsoft visual studio 8\vc\include\swprintf.inl(50) : error C2084: function 'int vswprintf(wchar_t *,size_t,const wchar_t *,va_list)' already has a body c:\program files (x86)\microsoft visual studio 8\vc\include\swprintf.inl(49) : see previous definition of 'vswprintf' c:\program files (x86)\microsoft visual studio 8\vc\include\swprintf.inl(61) : error C2084: function 'int _swprintf_l(wchar_t *,size_t,const wchar_t *,_locale_t,...)' already has a body c:\program files (x86)\microsoft visual studio 8\vc\include\swprintf.inl(60) : see previous definition of '_swprintf_l' c:\program files (x86)\microsoft visual studio 8\vc\include\swprintf.inl(74) : error C2084: function 'int _vswprintf_l(wchar_t *,size_t,const wchar_t *,_locale_t,va_list)' already has a body c:\program files (x86)\microsoft visual studio 8\vc\include\swprintf.inl(73) : see previous definition of '_vswprintf_l' c:\program files (x86)\microsoft visual studio 8\vc\include\swprintf.inl(86) : error C2084: function 'int swprintf(wchar_t *,const wchar_t *,...)' already has a body c:\program files (x86)\microsoft visual studio 8\vc\include\swprintf.inl(85) : see previous definition of 'swprintf' c:\program files (x86)\microsoft visual studio 8\vc\include\swprintf.inl(98) : error C2084: function 'int vswprintf(wchar_t *,const wchar_t *,va_list)' already has a body c:\program files (x86)\microsoft visual studio 8\vc\include\swprintf.inl(97) : see previous definition of 'vswprintf' c:\program files (x86)\microsoft visual studio 8\vc\include\swprintf.inl(106) : error C2084: function 'int _swprintf_l(wchar_t *,const wchar_t *,_locale_t,...)' already has a body c:\program files (x86)\microsoft visual studio 8\vc\include\swprintf.inl(105) : see previous definition of '_swprintf_l' c:\program files (x86)\microsoft visual studio 8\vc\include\swprintf.inl(118) : error C2084: function 'int _vswprintf_l(wchar_t *,const wchar_t *,_locale_t,va_list)' already has a body c:\program files (x86)\microsoft visual studio 8\vc\include\swprintf.inl(117) : see previous definition of '_vswprintf_l' c:\program files (x86)\microsoft visual studio 8\vc\include\stdio.h(572) : error C2995: 'errno_t _wtmpnam_s(wchar_t (&)[_Size])' : function template has already been defined c:\program files (x86)\microsoft visual studio 8\vc\include\stdio.h(572) : see declaration of '_wtmpnam_s' c:\program files (x86)\microsoft visual studio 8\vc\include\stdio.h(586) : error C2084: function 'wint_t getwchar(void)' already has a body c:\program files (x86)\microsoft visual studio 8\vc\include\stdio.h(414) : see previous definition of 'getwchar' c:\program files (x86)\microsoft visual studio 8\vc\include\stdio.h(588) : error C2084: function 'wint_t putwchar(wchar_t)' already has a body c:\program files (x86)\microsoft visual studio 8\vc\include\stdio.h(416) : see previous definition of 'putwchar' c:\program files (x86)\microsoft visual studio 8\vc\include\string.h(68) : error C2995: 'errno_t _strset_s(char (&)[_Size],int)' : function template has already been defined c:\program files (x86)\microsoft visual studio 8\vc\include\string.h(68) : see declaration of '_strset_s' c:\program files (x86)\microsoft visual studio 8\vc\include\string.h(73) : error C2995: 'errno_t strcpy_s(char (&)[_Size],const char *)' : function template has already been defined c:\program files (x86)\microsoft visual studio 8\vc\include\string.h(73) : see declaration of 'strcpy_s' c:\program files (x86)\microsoft visual studio 8\vc\include\string.h(78) : error C2995: 'errno_t strcat_s(char (&)[_Size],const char *)' : function template has already been defined c:\program files (x86)\microsoft visual studio 8\vc\include\string.h(78) : see declaration of 'strcat_s' c:\program files (x86)\microsoft visual studio 8\vc\include\string.h(85) : error C2084: function 'size_t strnlen_s(const char *,size_t)' already has a body c:\program files (x86)\microsoft visual studio 8\vc\include\string.h(84) : see previous definition of 'strnlen_s' c:\program files (x86)\microsoft visual studio 8\vc\include\string.h(125) : error C2995: 'errno_t _strerror_s(char (&)[_Size],const char *)' : function template has already been defined c:\program files (x86)\microsoft visual studio 8\vc\include\string.h(125) : see declaration of '_strerror_s' c:\program files (x86)\microsoft visual studio 8\vc\include\string.h(130) : error C2995: 'errno_t strerror_s(char (&)[_Size],int)' : function template has already been defined c:\program files (x86)\microsoft visual studio 8\vc\include\string.h(130) : see declaration of 'strerror_s' c:\program files (x86)\microsoft visual studio 8\vc\include\string.h(132) : error C2995: 'errno_t _strlwr_s(char (&)[_Size])' : function template has already been defined c:\program files (x86)\microsoft visual studio 8\vc\include\string.h(132) : see declaration of '_strlwr_s' c:\program files (x86)\microsoft visual studio 8\vc\include\string.h(135) : error C2995: 'errno_t _strlwr_s_l(char (&)[_Size],_locale_t)' : function template has already been defined c:\program files (x86)\microsoft visual studio 8\vc\include\string.h(135) : see declaration of '_strlwr_s_l' c:\program files (x86)\microsoft visual studio 8\vc\include\string.h(140) : error C2995: 'errno_t strncat_s(char (&)[_Size],const char *,size_t)' : function template has already been defined c:\program files (x86)\microsoft visual studio 8\vc\include\string.h(140) : see declaration of 'strncat_s' c:\program files (x86)\microsoft visual studio 8\vc\include\string.h(156) : error C2995: 'errno_t strncpy_s(char (&)[_Size],const char *,size_t)' : function template has already been defined c:\program files (x86)\microsoft visual studio 8\vc\include\string.h(156) : see declaration of 'strncpy_s' c:\program files (x86)\microsoft visual studio 8\vc\include\string.h(159) : error C2995: 'errno_t _strnset_s(char (&)[_Size],int,size_t)' : function template has already been defined c:\program files (x86)\microsoft visual studio 8\vc\include\string.h(159) : see declaration of '_strnset_s' c:\program files (x86)\microsoft visual studio 8\vc\include\string.h(171) : error C2995: 'errno_t _strupr_s(char (&)[_Size])' : function template has already been defined c:\program files (x86)\microsoft visual studio 8\vc\include\string.h(171) : see declaration of '_strupr_s' c:\program files (x86)\microsoft visual studio 8\vc\include\string.h(174) : error C2995: 'errno_t _strupr_s_l(char (&)[_Size],_locale_t)' : function template has already been defined c:\program files (x86)\microsoft visual studio 8\vc\include\string.h(174) : see declaration of '_strupr_s_l' c:\program files (x86)\microsoft visual studio 8\vc\include\string.h(184) : error C2084: function 'char *strchr(char *,int)' already has a body c:\program files (x86)\microsoft visual studio 8\vc\include\string.h(183) : see previous definition of 'strchr' c:\program files (x86)\microsoft visual studio 8\vc\include\string.h(186) : error C2084: function 'char *strpbrk(char *,const char *)' already has a body c:\program files (x86)\microsoft visual studio 8\vc\include\string.h(185) : see previous definition of 'strpbrk' c:\program files (x86)\microsoft visual studio 8\vc\include\string.h(188) : error C2084: function 'char *strrchr(char *,int)' already has a body c:\program files (x86)\microsoft visual studio 8\vc\include\string.h(187) : see previous definition of 'strrchr' c:\program files (x86)\microsoft visual studio 8\vc\include\string.h(190) : error C2084: function 'char *strstr(char *,const char *)' already has a body c:\program files (x86)\microsoft visual studio 8\vc\include\string.h(189) : see previous definition of 'strstr' c:\program files (x86)\microsoft visual studio 8\vc\include\string.h(195) : error C2084: function 'void *memchr(void *,int,size_t)' already has a body c:\program files (x86)\microsoft visual studio 8\vc\include\string.h(194) : see previous definition of 'memchr' c:\program files (x86)\microsoft visual studio 8\vc\include\string.h(244) : error C2995: 'errno_t wcscat_s(wchar_t (&)[_Size],const wchar_t *)' : function template has already been defined c:\program files (x86)\microsoft visual studio 8\vc\include\string.h(244) : see declaration of 'wcscat_s' c:\program files (x86)\microsoft visual studio 8\vc\include\string.h(251) : error C2995: 'errno_t wcscpy_s(wchar_t (&)[_Size],const wchar_t *)' : function template has already been defined c:\program files (x86)\microsoft visual studio 8\vc\include\string.h(251) : see declaration of 'wcscpy_s' c:\program files (x86)\microsoft visual studio 8\vc\include\string.h(258) : error C2084: function 'size_t wcsnlen_s(const wchar_t *,size_t)' already has a body c:\program files (x86)\microsoft visual studio 8\vc\include\string.h(257) : see previous definition of 'wcsnlen_s' c:\program files (x86)\microsoft visual studio 8\vc\include\string.h(265) : error C2995: 'errno_t wcsncat_s(wchar_t (&)[_Size],const wchar_t *,size_t)' : function template has already been defined c:\program files (x86)\microsoft visual studio 8\vc\include\string.h(265) : see declaration of 'wcsncat_s' c:\program files (x86)\microsoft visual studio 8\vc\include\string.h(271) : error C2995: 'errno_t wcsncpy_s(wchar_t (&)[_Size],const wchar_t *,size_t)' : function template has already been defined c:\program files (x86)\microsoft visual studio 8\vc\include\string.h(271) : see declaration of 'wcsncpy_s' c:\program files (x86)\microsoft visual studio 8\vc\include\string.h(281) : error C2995: 'errno_t _wcserror_s(wchar_t (&)[_Size],int)' : function template has already been defined c:\program files (x86)\microsoft visual studio 8\vc\include\string.h(281) : see declaration of '_wcserror_s' c:\program files (x86)\microsoft visual studio 8\vc\include\string.h(284) : error C2995: 'errno_t __wcserror_s(wchar_t (&)[_Size],const wchar_t *)' : function template has already been defined c:\program files (x86)\microsoft visual studio 8\vc\include\string.h(284) : see declaration of '__wcserror_s' c:\program files (x86)\microsoft visual studio 8\vc\include\string.h(291) : error C2995: 'errno_t _wcsnset_s(wchar_t (&)[_Size],wchar_t,size_t)' : function template has already been defined c:\program files (x86)\microsoft visual studio 8\vc\include\string.h(291) : see declaration of '_wcsnset_s' c:\program files (x86)\microsoft visual studio 8\vc\include\string.h(295) : error C2995: 'errno_t _wcsset_s(wchar_t (&)[_Size],wchar_t)' : function template has already been defined c:\program files (x86)\microsoft visual studio 8\vc\include\string.h(295) : see declaration of '_wcsset_s' c:\program files (x86)\microsoft visual studio 8\vc\include\string.h(299) : error C2995: 'errno_t _wcslwr_s(wchar_t (&)[_Size])' : function template has already been defined c:\program files (x86)\microsoft visual studio 8\vc\include\string.h(299) : see declaration of '_wcslwr_s' c:\program files (x86)\microsoft visual studio 8\vc\include\string.h(302) : error C2995: 'errno_t _wcslwr_s_l(wchar_t (&)[_Size],_locale_t)' : function template has already been defined c:\program files (x86)\microsoft visual studio 8\vc\include\string.h(302) : see declaration of '_wcslwr_s_l' c:\program files (x86)\microsoft visual studio 8\vc\include\string.h(305) : error C2995: 'errno_t _wcsupr_s(wchar_t (&)[_Size])' : function template has already been defined c:\program files (x86)\microsoft visual studio 8\vc\include\string.h(305) : see declaration of '_wcsupr_s' c:\program files (x86)\microsoft visual studio 8\vc\include\string.h(308) : error C2995: 'errno_t _wcsupr_s_l(wchar_t (&)[_Size],_locale_t)' : function template has already been defined c:\program files (x86)\microsoft visual studio 8\vc\include\string.h(308) : see declaration of '_wcsupr_s_l' c:\program files (x86)\microsoft visual studio 8\vc\include\string.h(326) : error C2084: function 'wchar_t *wcschr(wchar_t *,wchar_t)' already has a body c:\program files (x86)\microsoft visual studio 8\vc\include\string.h(325) : see previous definition of 'wcschr' c:\program files (x86)\microsoft visual studio 8\vc\include\string.h(328) : error C2084: function 'wchar_t *wcspbrk(wchar_t *,const wchar_t *)' already has a body c:\program files (x86)\microsoft visual studio 8\vc\include\string.h(327) : see previous definition of 'wcspbrk' c:\program files (x86)\microsoft visual studio 8\vc\include\string.h(330) : error C2084: function 'wchar_t *wcsrchr(wchar_t *,wchar_t)' already has a body c:\program files (x86)\microsoft visual studio 8\vc\include\string.h(329) : see previous definition of 'wcsrchr' c:\program files (x86)\microsoft visual studio 8\vc\include\string.h(332) : error C2084: function 'wchar_t *wcsstr(wchar_t *,const wchar_t *)' already has a body c:\program files (x86)\microsoft visual studio 8\vc\include\string.h(331) : see previous definition of 'wcsstr' c:\program files (x86)\microsoft visual studio 8\vc\include\wchar.h(94) : error C2011: '_wfinddata32_t' : 'struct' type redefinition c:\program files (x86)\microsoft visual studio 8\vc\include\wchar.h(94) : see declaration of '_wfinddata32_t' c:\program files (x86)\microsoft visual studio 8\vc\include\wchar.h(105) : error C2011: '_wfinddata32i64_t' : 'struct' type redefinition c:\program files (x86)\microsoft visual studio 8\vc\include\wchar.h(105) : see declaration of '_wfinddata32i64_t' c:\program files (x86)\microsoft visual studio 8\vc\include\wchar.h(114) : error C2011: '_wfinddata64i32_t' : 'struct' type redefinition c:\program files (x86)\microsoft visual studio 8\vc\include\wchar.h(114) : see declaration of '_wfinddata64i32_t' c:\program files (x86)\microsoft visual studio 8\vc\include\wchar.h(123) : error C2011: '_wfinddata64_t' : 'struct' type redefinition c:\program files (x86)\microsoft visual studio 8\vc\include\wchar.h(123) : see declaration of '_wfinddata64_t' c:\program files (x86)\microsoft visual studio 8\vc\include\wchar.h(272) : error C2059: syntax error : '(' c:\program files (x86)\microsoft visual studio 8\vc\include\wchar.h(273) : error C2059: syntax error : '(' c:\program files (x86)\microsoft visual studio 8\vc\include\wchar.h(274) : error C2059: syntax error : '(' c:\program files (x86)\microsoft visual studio 8\vc\include\wchar.h(275) : error C2059: syntax error : '(' c:\program files (x86)\microsoft visual studio 8\vc\include\wchar.h(323) : error C2995: 'errno_t _wmktemp_s(wchar_t (&)[_Size])' : function template has already been defined c:\program files (x86)\microsoft visual studio 8\vc\include\wchar.h(323) : see declaration of '_wmktemp_s' c:\program files (x86)\microsoft visual studio 8\vc\include\wchar.h(345) : error C2572: '_wopen' : redefinition of default parameter : parameter 3 c:\program files (x86)\microsoft visual studio 8\vc\include\wchar.h(345) : see declaration of '_wopen' c:\program files (x86)\microsoft visual studio 8\vc\include\wchar.h(346) : error C2572: '_wsopen' : redefinition of default parameter : parameter 4 c:\program files (x86)\microsoft visual studio 8\vc\include\wchar.h(346) : see declaration of '_wsopen' c:\program files (x86)\microsoft visual studio 8\vc\include\wchar.h(492) : error C2011: '_stat32' : 'struct' type redefinition c:\program files (x86)\microsoft visual studio 8\vc\include\wchar.h(492) : see declaration of '_stat32' c:\program files (x86)\microsoft visual studio 8\vc\include\wchar.h(508) : error C2011: 'stat' : 'struct' type redefinition c:\program files (x86)\microsoft visual studio 8\vc\include\wchar.h(508) : see declaration of 'stat' c:\program files (x86)\microsoft visual studio 8\vc\include\wchar.h(526) : error C2011: '_stat32i64' : 'struct' type redefinition c:\program files (x86)\microsoft visual studio 8\vc\include\wchar.h(526) : see declaration of '_stat32i64' c:\program files (x86)\microsoft visual studio 8\vc\include\wchar.h(540) : error C2011: '_stat64i32' : 'struct' type redefinition c:\program files (x86)\microsoft visual studio 8\vc\include\wchar.h(540) : see declaration of '_stat64i32' c:\program files (x86)\microsoft visual studio 8\vc\include\wchar.h(554) : error C2011: '_stat64' : 'struct' type redefinition c:\program files (x86)\microsoft visual studio 8\vc\include\wchar.h(554) : see declaration of '_stat64' c:\program files (x86)\microsoft visual studio 8\vc\include\wchar.h(625) : error C2995: 'errno_t _cgetws_s(wchar_t (&)[_Size],size_t *)' : function template has already been defined c:\program files (x86)\microsoft visual studio 8\vc\include\wchar.h(625) : see declaration of '_cgetws_s' c:\program files (x86)\microsoft visual studio 8\vc\include\wchar.h(877) : error C2995: 'errno_t _itow_s(int,wchar_t (&)[_Size],int)' : function template has already been defined c:\program files (x86)\microsoft visual studio 8\vc\include\wchar.h(877) : see declaration of '_itow_s' c:\program files (x86)\microsoft visual studio 8\vc\include\wchar.h(880) : error C2995: 'errno_t _ltow_s(long,wchar_t (&)[_Size],int)' : function template has already been defined c:\program files (x86)\microsoft visual studio 8\vc\include\wchar.h(880) : see declaration of '_ltow_s' c:\program files (x86)\microsoft visual studio 8\vc\include\wchar.h(883) : error C2995: 'errno_t _ultow_s(unsigned long,wchar_t (&)[_Size],int)' : function template has already been defined c:\program files (x86)\microsoft visual studio 8\vc\include\wchar.h(883) : see declaration of '_ultow_s' c:\program files (x86)\microsoft visual studio 8\vc\include\wchar.h(893) : error C2995: 'errno_t _wgetenv_s(size_t *,wchar_t (&)[_Size],const wchar_t *)' : function template has already been defined c:\program files (x86)\microsoft visual studio 8\vc\include\wchar.h(893) : see declaration of '_wgetenv_s' c:\program files (x86)\microsoft visual studio 8\vc\include\wchar.h(951) : error C2995: 'errno_t _wmakepath_s(wchar_t (&)[_Size],const wchar_t *,const wchar_t *,const wchar_t *,const wchar_t *)' : function template has already been defined c:\program files (x86)\microsoft visual studio 8\vc\include\wchar.h(951) : see declaration of '_wmakepath_s' c:\program files (x86)\microsoft visual studio 8\vc\include\wchar.h(960) : error C2995: 'errno_t _wsearchenv_s(const wchar_t *,const wchar_t *,wchar_t (&)[_Size])' : function template has already been defined c:\program files (x86)\microsoft visual studio 8\vc\include\wchar.h(960) : see declaration of '_wsearchenv_s' c:\program files (x86)\microsoft visual studio 8\vc\include\wchar.h(968) : error C2995: 'errno_t _wsplitpath_s(const wchar_t *,wchar_t (&)[_DriveSize],wchar_t (&)[_DirSize],wchar_t (&)[_NameSize],wchar_t (&)[_ExtSize])' : function template has already been defined c:\program files (x86)\microsoft visual studio 8\vc\include\wchar.h(968) : see declaration of '_wsplitpath_s' c:\program files (x86)\microsoft visual studio 8\vc\include\wchar.h(1119) : error C2011: 'tm' : 'struct' type redefinition c:\program files (x86)\microsoft visual studio 8\vc\include\wchar.h(1119) : see declaration of 'tm' c:\program files (x86)\microsoft visual studio 8\vc\include\wchar.h(1139) : error C2995: 'errno_t _wasctime_s(wchar_t (&)[_Size],const tm *)' : function template has already been defined c:\program files (x86)\microsoft visual studio 8\vc\include\wchar.h(1139) : see declaration of '_wasctime_s' c:\program files (x86)\microsoft visual studio 8\vc\include\wchar.h(1143) : error C2995: 'errno_t _wctime32_s(wchar_t (&)[_Size],const __time32_t *)' : function template has already been defined c:\program files (x86)\microsoft visual studio 8\vc\include\wchar.h(1143) : see declaration of '_wctime32_s' c:\program files (x86)\microsoft visual studio 8\vc\include\wchar.h(1149) : error C2995: 'errno_t _wstrdate_s(wchar_t (&)[_Size])' : function template has already been defined c:\program files (x86)\microsoft visual studio 8\vc\include\wchar.h(1149) : see declaration of '_wstrdate_s' c:\program files (x86)\microsoft visual studio 8\vc\include\wchar.h(1153) : error C2995: 'errno_t _wstrtime_s(wchar_t (&)[_Size])' : function template has already been defined c:\program files (x86)\microsoft visual studio 8\vc\include\wchar.h(1153) : see declaration of '_wstrtime_s' c:\program files (x86)\microsoft visual studio 8\vc\include\wchar.h(1159) : error C2995: 'errno_t _wctime64_s(wchar_t (&)[_Size],const __time64_t *)' : function template has already been defined c:\program files (x86)\microsoft visual studio 8\vc\include\wchar.h(1159) : see declaration of '_wctime64_s' c:\program files (x86)\microsoft visual studio 8\vc\include\wtime.inl(47) : error C2084: function 'wchar_t *_wctime(const time_t *)' already has a body c:\program files (x86)\microsoft visual studio 8\vc\include\wtime.inl(46) : see previous definition of '_wctime' c:\program files (x86)\microsoft visual studio 8\vc\include\wtime.inl(55) : error C2084: function 'errno_t _wctime_s(wchar_t *,size_t,const time_t *)' already has a body c:\program files (x86)\microsoft visual studio 8\vc\include\wtime.inl(54) : see previous definition of '_wctime_s' c:\program files (x86)\microsoft visual studio 8\vc\include\wchar.h(1179) : error C2995: 'errno_t mbsrtowcs_s(size_t *,wchar_t (&)[_Size],const char **,size_t,mbstate_t *)' : function template has already been defined c:\program files (x86)\microsoft visual studio 8\vc\include\wchar.h(1179) : see declaration of 'mbsrtowcs_s' c:\program files (x86)\microsoft visual studio 8\vc\include\wchar.h(1184) : error C2995: 'errno_t wcrtomb_s(size_t *,char (&)[_Size],wchar_t,mbstate_t *)' : function template has already been defined c:\program files (x86)\microsoft visual studio 8\vc\include\wchar.h(1184) : see declaration of 'wcrtomb_s' c:\program files (x86)\microsoft visual studio 8\vc\include\wchar.h(1188) : error C2995: 'errno_t wcsrtombs_s(size_t *,char (&)[_Size],const wchar_t **,size_t,mbstate_t *)' : function template has already been defined c:\program files (x86)\microsoft visual studio 8\vc\include\wchar.h(1188) : see declaration of 'wcsrtombs_s' c:\program files (x86)\microsoft visual studio 8\vc\include\wchar.h(1206) : error C2084: function 'int fwide(FILE *,int)' already has a body c:\program files (x86)\microsoft visual studio 8\vc\include\wchar.h(1205) : see previous definition of 'fwide' c:\program files (x86)\microsoft visual studio 8\vc\include\wchar.h(1208) : error C2084: function 'int mbsinit(const mbstate_t *)' already has a body c:\program files (x86)\microsoft visual studio 8\vc\include\wchar.h(1207) : see previous definition of 'mbsinit' c:\program files (x86)\microsoft visual studio 8\vc\include\wchar.h(1208) : fatal error C1003: error count exceeds 100; stopping compilation Build log was saved at "file://c:\codeworks\build\ bin\server\win\Debug\obj\BuildLog.htm" Worker - 102 error(s), 1 warning(s) ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Thanks, Ram
On 29/09/2016 19:40, Ram wrote:
Since this is C++11 code, let's go back to basics for a moment. Exactly *which* version of Visual Studio are you using?
I am NOT using C++11. I am using Visual Studio 2005,
As Chris indicated, the code that you quoted from the .i file earlier in the thread is definitely C++11 code, which VS2005 cannot compile, which in turn is probably why you're getting the errors. Hence something you are including contains the wrong code. Either you are including a C++11-only library somewhere, your include paths are wrong (and eg. including CRT code from the wrong version of VS), or you're defining preprocessor symbols that you shouldn't and hence confusing Boost's platform detection. On that note, what do you have in the C++/Preprocessor/Preprocessor Definitions setting? (Click on it and go to Edit, then copy both the top panel and the bottom Inherited Values panel.)
I compiled just that one file(after making changes to log preprocessor output to file). Replaced the contents of the same file by the contents of the .i file and tried compiling again and I get lot of errors as follows. Looks like I am doing something wrong.
------ Build started: Project: Worker, Configuration: Debug Win32 ------ Compiling... cl : Command line warning D9007 : '/C' requires '/E, /EP or /P'; option ignored
You need to turn the option off again after generating the .i file, just like the option to generate the .i file in the first place.
c:\program files (x86)\microsoft visual studio 8\vc\include\crtdefs.h(2042) : error C2011: 'localeinfo_struct' : 'struct' type redefinition c:\program files (x86)\microsoft visual studio 8\vc\include\crtdefs.h(2042) : see declaration of 'localeinfo_struct'
These sorts of errors suggest that you probably didn't turn off precompiled headers. You need to do that when compiling a .i file, since it contains all the code inline instead of including the stdafx.h file.
On 10.10.2016 01:33, Gavin Lambert wrote:
On 29/09/2016 19:40, Ram wrote:
Since this is C++11 code, let's go back to basics for a moment. Exactly *which* version of Visual Studio are you using?
I am NOT using C++11. I am using Visual Studio 2005,
As Chris indicated, the code that you quoted from the .i file earlier in the thread is definitely C++11 code, which VS2005 cannot compile, which in turn is probably why you're getting the errors. Gavin,
judging from the Date: header these were couple of old email that got delivered with slight :-) delay. I think these issues were already addressed. Cheers, Leon
Thanks a lot all! The problem was addressed. I recently found out that if I include the boost headers in the beginning(as the first headers), before any of the project headers(we have a header file in our project where we add files we want to add first) it worked. I am not sure why! -Ram
On 11/10/2016 16:36, Ram wrote:
Thanks a lot all! The problem was addressed. I recently found out that if I include the boost headers in the beginning(as the first headers), before any of the project headers(we have a header file in our project where we add files we want to add first) it worked. I am not sure why!
Most likely, one of the headers in between where you had it before and where you have it now #defined or #included something it shouldn't. So you might run into it again later if you don't track it down.
Hi Gavin, [Most likely, one of the headers in between where you had it before and where you have it now #defined or #included something it shouldn't. So you might run into it again later if you don't track it down] Thanks I will look into it now. Thanks, Ram
On 11.10.2016 05:36, Ram wrote:
Thanks a lot all! The problem was addressed. I recently found out that if I include the boost headers in the beginning(as the first headers), before any of the project headers(we have a header file in our project where we add files we want to add first) it worked. I am not sure why! Ahem ... there should be a book written (I can suggest the title: "The use and abuse of #include directive") about improperly structured #includes ... probably a multi-volume set full of horror stories.
The include order: 1. System/standard header files 2. Other libraries header files 3. Project header files usually works best, unless there is a very good reason to change it. That, and only include what you need where you need it ... I suspect Gavin is right and it's going to bite you again unless you find the root cause. Cheers, Leon
On 11/10/2016 21:28, Leon Mlakar wrote:
Ahem ... there should be a book written (I can suggest the title: "The use and abuse of #include directive") about improperly structured #includes ... probably a multi-volume set full of horror stories.
The include order:
1. System/standard header files 2. Other libraries header files 3. Project header files
usually works best, unless there is a very good reason to change it.
One rule of thumb that I try to follow is to include the header file for the current cpp file first, before anything else (except stdafx.h, if you're using that). This helps ensure that the .h file contains all the forward references and/or #includes that are actually required by the interface, which makes it easier to consume elsewhere. (Although you might miss something that's in your stdafx -- but that's not usually an issue unless you're also consuming it from a different project.) ie. CoolWidget.cpp has these includes: #include "stdafx.h" #include "CoolWidget.h" #include <other system includes> #include <other library includes> #include "other project includes" Having said that, *properly written* include files should be includable in any order, since they should include what they need to depend on and should be ignored if included more than once. (This is not reality, though.) Where you get tripped up is when some headers try to interfere with others via #defines (eg. settings), or you try to integrate components that disagree in ABI-affecting ways. (I recall a recent thread mentioning issues when trying to use a library that uses Asio in an application that also uses Asio, but with different settings.) I'm interested to see what effects modules have on this, once they exist, since theoretically they're supposed to be immune to being affected by #defines like this and yet some libraries are still going to need to provide ABI-affecting configuration options.
Hi Gavin,
I guess my previous mail didnt reach you due to its size. Here it is,
"
Hi Gavin,
[
If you rename the .i file as a .cpp you can then add it to your project and
right-click-Compile it individually. If it still shows the original line
numbers then generate the .i file again but turn on the "Preprocess
Suppress Line Numbers" setting as well.
]
I will definitely try this right away and let you know.
[
Since this is C++11 code, let's go back to basics for a moment. Exactly
*which* version of Visual Studio are you using?
]
I am NOT using C++11. I am using Visual Studio 2005,
Microsoft Visual Studio 2005
Version 8.0.50727.867 (vsvista.050727-8600)
Thanks,
Ram
On Thu, Sep 29, 2016 at 11:46 AM, Gavin Lambert
Mere moments ago, quoth I:
Since this is C++11 code, let's go back to basics for a moment. Exactly *which* version of Visual Studio are you using? (Both the main version and which Update you've installed. You can check that in the About window.)
Also which Boost version you're using too.
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
Hi Gavin, [ If you rename the .i file as a .cpp you can then add it to your project and right-click-Compile it individually. If it still shows the original line numbers then generate the .i file again but turn on the "Preprocess Suppress Line Numbers" setting as well. ] I compiled just that one file(after making changes to log preprocessor output to file). Replaced the contents of the same file by the contents of the .i file and tried compiling again and I get lot of errors as follows. Looks like I am doing something wrong. ------ Build started: Project: Worker, Configuration: Debug Win32 ------ Compiling... cl : Command line warning D9007 : '/C' requires '/E, /EP or /P'; option ignored manager_abc.cpp c:\program files (x86)\microsoft visual studio 8\vc\include\crtdefs.h(2042) : error C2011: 'localeinfo_struct' : 'struct' type redefinition c:\program files (x86)\microsoft visual studio 8\vc\include\crtdefs.h(2042) : see declaration of 'localeinfo_struct' c:\program files (x86)\microsoft visual studio 8\vc\include\crtdefs.h(2048) : error C2011: 'tagLC_ID' : 'struct' type redefinition c:\program files (x86)\microsoft visual studio 8\vc\include\crtdefs.h(2048) : see declaration of 'tagLC_ID' c:\program files (x86)\microsoft visual studio 8\vc\include\crtdefs.h(2057) : error C2011: 'threadlocaleinfostruct' : 'struct' type redefinition c:\program files (x86)\microsoft visual studio 8\vc\include\crtdefs.h(2057) : see declaration of 'threadlocaleinfostruct' c:\program files (x86)\microsoft visual studio 8\vc\include\yvals.h(561) : error C2011: 'std::_Lockit' : 'class' type redefinition c:\program files (x86)\microsoft visual studio 8\vc\include\yvals.h(561) : see declaration of 'std::_Lockit' c:\program files (x86)\microsoft visual studio 8\vc\include\yvals.h(708) : error C2011: 'std::_Mutex' : 'class' type redefinition c:\program files (x86)\microsoft visual studio 8\vc\include\yvals.h(708) : see declaration of 'std::_Mutex' c:\program files (x86)\microsoft visual studio 8\vc\include\yvals.h(760) : error C2011: 'std::_Init_locks' : 'class' type redefinition c:\program files (x86)\microsoft visual studio 8\vc\include\yvals.h(760) : see declaration of 'std::_Init_locks' c:\program files (x86)\microsoft visual studio 8\vc\include\stdio.h(59) : error C2011: '_iobuf' : 'struct' type redefinition c:\program files (x86)\microsoft visual studio 8\vc\include\stdio.h(59) : see declaration of '_iobuf' c:\program files (x86)\microsoft visual studio 8\vc\include\stdio.h(269) : error C2995: 'char *gets_s(char (&)[_Size])' : function template has already been defined c:\program files (x86)\microsoft visual studio 8\vc\include\stdio.h(269) : see declaration of 'gets_s' c:\program files (x86)\microsoft visual studio 8\vc\include\stdio.h(307) : error C2995: 'int _snprintf_s(char (&)[_Size],size_t,const char *,...)' : function template has already been defined c:\program files (x86)\microsoft visual studio 8\vc\include\stdio.h(307) : see declaration of '_snprintf_s' c:\program files (x86)\microsoft visual studio 8\vc\include\stdio.h(309) : error C2995: 'int sprintf_s(char (&)[_Size],const char *,...)' : function template has already been defined c:\program files (x86)\microsoft visual studio 8\vc\include\stdio.h(309) : see declaration of 'sprintf_s' c:\program files (x86)\microsoft visual studio 8\vc\include\stdio.h(326) : error C2995: 'errno_t tmpnam_s(char (&)[_Size])' : function template has already been defined c:\program files (x86)\microsoft visual studio 8\vc\include\stdio.h(326) : see declaration of 'tmpnam_s' c:\program files (x86)\microsoft visual studio 8\vc\include\stdio.h(336) : error C2995: 'int _vsnprintf_s(char (&)[_Size],size_t,const char *,va_list)' : function template has already been defined c:\program files (x86)\microsoft visual studio 8\vc\include\stdio.h(336) : see declaration of '_vsnprintf_s' c:\program files (x86)\microsoft visual studio 8\vc\include\stdio.h(342) : error C2995: 'int vsprintf_s(char (&)[_Size],const char *,va_list)' : function template has already been defined c:\program files (x86)\microsoft visual studio 8\vc\include\stdio.h(342) : see declaration of 'vsprintf_s' c:\program files (x86)\microsoft visual studio 8\vc\include\stdio.h(422) : error C2995: 'wchar_t *_getws_s(wchar_t (&)[_Size])' : function template has already been defined c:\program files (x86)\microsoft visual studio 8\vc\include\stdio.h(422) : see declaration of '_getws_s' ...and so on... Thanks, Ram
Sorry, I had sent these mails previously but didnt reach you due to size concerns. Made my mails smaller now and sent them again. Looking forward to your help. Thanks, Ram
Hi Gavin,
I tried adding a new CPP file to my project and had only this in the file,
#include
Hi Gavin/Joaquin,
I tried adding just this to one file in our client project code,
#include "boost/tr1/unordered_map.hpp"
unordered_map
On 29.09.2016 10:27, Ram wrote:
Hi Gavin,
I guess my previous mail didnt reach you due to its size. Here it is, " Hi Gavin,
[ If you rename the .i file as a .cpp you can then add it to your project and right-click-Compile it individually. If it still shows the original line numbers then generate the .i file again but turn on the "Preprocess Suppress Line Numbers" setting as well. ] I will definitely try this right away and let you know.
[ Since this is C++11 code, let's go back to basics for a moment. Exactly *which* version of Visual Studio are you using? ] I am NOT using C++11. I am using Visual Studio 2005, Microsoft Visual Studio 2005 Version 8.0.50727.867 (vsvista.050727-8600)
This: void construct(_Objty *_Ptr, _Types&&... _Args) { ::new ((void *)_Ptr) _Objty(::std:: forward<_Types>(_Args)...); } is C++11 code. Best regards, Leon
Hi, What we use is I am using Visual Studio 2005, Version 8.0.50727.867 (vsvista.050727-8600) [ void construct(_Objty *_Ptr, _Types&&... _Args) { ::new ((void *)_Ptr) _Objty(::std:: forward<_Types>(_Args)...); } ] This output must be from boost? I am using boost_1_61_0. Thanks, Ram
On 29.09.2016 15:57, Ram wrote:
Hi,
What we use is I am using Visual Studio 2005, Version 8.0.50727.867 (vsvista.050727-8600)
[ void construct(_Objty *_Ptr, _Types&&... _Args) { ::new ((void *)_Ptr) _Objty(::std:: forward<_Types>(_Args)...); } ]
This output must be from boost? I am using boost_1_61_0.
Yes, I understood that you are using Visual Studio 2005. What I'm saying is if this is output from the preprocessor which gets fed into your compiler, VS 2005 compiler will not be able to compile it because operator &&, variadic template parameter packs and std::forward are all features of C++11 and unknown to your compiler, which is about 8 years too old. Only VS 2013 got decent support for C++11 features. Best regards, Leon
Ohhh thanks a lot Leon! That explains why my boost::multi_index did not work too!! I was breaking my head over this for the last 2 weeks! Thanks, Ram
On 29.09.2016 18:17, Ram wrote:
Ohhh thanks a lot Leon! That explains why my boost::multi_index did not work too!! I was breaking my head over this for the last 2 weeks!
And another thing: boost::unrodered_map has been around for quite some time, certainly before C++11 came around. So has boost::multi_index, I remember using it with pre-C++11 compilers. I have no idea why exactly you get the C++11 code you posted ... might be that Boost 1.61 requires C++11 (which I doubt), may be something with you config, your Boost installation or similar. Best regards, Leon
This:
void construct(_Objty *_Ptr, _Types&&... _Args) { ::new ((void *)_Ptr) _Objty(::std:: forward<_Types>(_Args)...); } is C++11 code. Best regards, Leon
This code is not coming from boost. I think this code is coming from the xmemory0 header packaged with the Visual C++ standard library. I don't have a version as old as VS2005 to confirm what it looks like there, but I have that exact snippet of code in my local VS2015 xmemory0 header (also in the allocator header). -- chris
On 29.09.2016 19:32, Chris Glover wrote:
This:
void construct(_Objty *_Ptr, _Types&&... _Args) { ::new ((void *)_Ptr) _Objty(::std:: forward<_Types>(_Args)...); } is C++11 code. Best regards, Leon
This code is not coming from boost. I think this code is coming from the xmemory0 header packaged with the Visual C++ standard library. I don't have a version as old as VS2005 to confirm what it looks like there, but I have that exact snippet of code in my local VS2015 xmemory0 header (also in the allocator header).
Yeah, having multiple VS installations could be it. This code surely can't come from VS2005 as it can't compile it, but I vaguely remember that old Visual Studios did have problems with multiple installations. Best regards, Leon
Hi, [ You're welcome. But it was actually Gavin who asked *the* question :-) ] Thanks Leon/Gavin and Joaquin! [ Yeah, having multiple VS installations could be it. This code surely can't come from VS2005 as it can't compile it, but I vaguely remember that old Visual Studios did have problems with multiple installations. ] I was thinking the same thing too. The VS2005 preprocessor would not give this output right? Also, I do have 2005 and 2013 installed. Does that mean if I uninstall 2013 and try compiling with 2005, it will compile successfully? Also I read in the boost's 1.61 documentation that it has been tested with older compilers than VS2005's. Having multiple VS versions is my problem? Thanks, Ram
Hi,
[ You're welcome. But it was actually Gavin who asked *the* question :-) ] Thanks Leon/Gavin and Joaquin!
[ Yeah, having multiple VS installations could be it. This code surely can't come from VS2005 as it can't compile it, but I vaguely remember that old Visual Studios did have problems with multiple installations. ] I was thinking the same thing too. The VS2005 preprocessor would not give this output right? Also, I do have 2005 and 2013 installed. Does that mean if I uninstall 2013 and try compiling with 2005, it will compile successfully?
Also I read in the boost's 1.61 documentation that it has been tested with older compilers than VS2005's.
Having multiple VS versions is my problem? Looks like it ... if Chis is right about the code origin, it could. Just took a quick look at xmemory0 header of VS20013 and yeah, it could have
On 29.09.2016 20:27, Ram wrote: produced such code after preprocessing. Just how exactly it ended up in VS2005 build is anybody's guess. Removing VS2013 ought to help, but make sure there are no files left lingering around. Better yet, do you have a possibility of setting up a virtual machine with with just VS2005 installed? Such clean environment would eliminate most variables. Cheers, Leon
On 30/09/2016 08:19, Leon Mlakar wrote:
Having multiple VS versions is my problem?
Looks like it ... if Chis is right about the code origin, it could. Just took a quick look at xmemory0 header of VS20013 and yeah, it could have produced such code after preprocessing. Just how exactly it ended up in VS2005 build is anybody's guess.
Removing VS2013 ought to help, but make sure there are no files left lingering around. Better yet, do you have a possibility of setting up a virtual machine with with just VS2005 installed? Such clean environment would eliminate most variables.
Since you said that it compiles correctly in a new solution but not in your intended one, it has to be a project setting. Check your include paths (in particular, check the Command Line tab under C/C++ Compiler, which shows the inherited and expanded paths as well) and make sure that it's not pulling in anything from different VS versions. If your project is sometimes compiled with other versions of VS, then perhaps also check if someone has hard-coded the full path to a VS2013 or similar header file instead of using relative paths as normal. (This'd be unusual, but you never know.) This is less likely if you tested the old and new solutions on the same PC, but in case you did test them on different PCs or different VS versions, then also check the VC++ Directories in the Options and the INCLUDE environment variable (if it exists, which is rare).
participants (6)
-
Chris Glover
-
Daniel James
-
Gavin Lambert
-
Joaquín M López Muñoz
-
Leon Mlakar
-
Ram