Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compiling errors VC2010 , QT4.8 #2

Closed
cybaman opened this issue Apr 22, 2013 · 5 comments
Closed

Compiling errors VC2010 , QT4.8 #2

cybaman opened this issue Apr 22, 2013 · 5 comments

Comments

@cybaman
Copy link

cybaman commented Apr 22, 2013

Not sure what is causing this error or what compilerbut a similar problem is described here:
http://heifner.blogspot.co.uk/2008/02/stdmin-and-stdmax.html.

I have manage to get it to compile by:
using namespace std;
and changing std::max to max on line 106 and 662 of format.h.

Here's the original compile error. there are also warnings shown with this fix.

M:\mmgit\mmcyb\inc\format.h(106): error C2589: '(' : illegal token on right side of '::'
1> M:\mmgit\mmcyb\inc\format.h(105) : while compiling class template member function 'void fmt::internal::Array<T,SIZE>::Grow(size_t)'
1> with
1> [
1> T=char,
1> SIZE=500
1> ]
1> M:\mmgit\mmcyb\inc\format.h(425) : see reference to class template instantiation 'fmt::internal::Array<T,SIZE>' being compiled
1> with
1> [
1> T=char,
1> SIZE=500
1> ]
1> M:\mmgit\mmcyb\inc\format.h(872) : see reference to class template instantiation 'fmt::BasicWriter' being compiled
1> with
1> [
1> Char=char
1> ]
1> M:\mmgit\mmcyb\inc\format.h(1128) : see reference to class template instantiation 'fmt::BasicFormatter' being compiled
1> with
1> [
1> Char=char
1> ]
1>M:\mmgit\mmcyb\inc\format.h(106): error C2059: syntax error : '::'
1>M:\mmgit\mmcyb\inc\format.h(106): error C2589: '(' : illegal token on right side of '::'
1> M:\mmgit\mmcyb\inc\format.h(105) : while compiling class template member function 'void fmt::internal::Array<T,SIZE>::Grow(size_t)'
1> with
1> [
1> T=const fmt::BasicFormatter::Arg *,
1> SIZE=10
1> ]
1> M:\mmgit\mmcyb\inc\format.h(979) : see reference to class template instantiation 'fmt::internal::Array<T,SIZE>' being compiled
1> with
1> [
1> T=const fmt::BasicFormatter::Arg *,
1> SIZE=10
1> ]
1>M:\mmgit\mmcyb\inc\format.h(106): error C2059: syntax error : '::'
1>
1>Build FAILED.
1>
1>Time Elapsed 00:00:00.98

@justnom
Copy link

justnom commented Apr 22, 2013

Not quite sure what errors you are getting - but you can just do what the article says and put

#define NOMINMAX 

after your windows.h include.

@cybaman
Copy link
Author

cybaman commented Apr 22, 2013

Thank you it worked, but have some warnings now.

C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xutility(2239): warning C4996: 'std::_Copy_impl': Function call with parameters that may be unsafe - this call relies on the caller to check that the passed values are correct. To disable this warning, use -D_SCL_SECURE_NO_WARNINGS. See documentation on how to use Visual C++ 'Checked Iterators'
2> C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xutility(2224) : see declaration of 'std::_Copy_impl'
2> M:\mmgit\mmcyb\inc\format.h(106) : see reference to function template instantiation '_OutIt std::copy<T*,T*>(_InIt,_InIt,_OutIt)' being compiled
2> with
2> [
2> _OutIt=char _,
2> T=char,
2> _InIt=char *
2> ]
2> M:\mmgit\mmcyb\inc\format.h(103) : while compiling class template member function 'void fmt::internal::Array<T,SIZE>::Grow(size_t)'
2> with
2> [
2> T=char,
2> SIZE=500
2> ]
2> M:\mmgit\mmcyb\inc\format.h(423) : see reference to class template instantiation 'fmt::internal::Array<T,SIZE>' being compiled
2> with
2> [
2> T=char,
2> SIZE=500
2> ]
2> M:\mmgit\mmcyb\inc\format.h(870) : see reference to class template instantiation 'fmt::BasicWriter' being compiled
2> with
2> [
2> Char=char
2> ]
2> M:\mmgit\mmcyb\inc\format.h(1126) : see reference to class template instantiation 'fmt::BasicFormatter' being compiled
2> with
2> [
2> Char=char
2> ]
2>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xutility(2239): warning C4996: 'std::_Copy_impl': Function call with parameters that may be unsafe - this call relies on the caller to check that the passed values are correct. To disable this warning, use -D_SCL_SECURE_NO_WARNINGS. See documentation on how to use Visual C++ 'Checked Iterators'
2> C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xutility(2224) : see declaration of 'std::Copy_impl'
2> M:\mmgit\mmcyb\inc\format.h(106) : see reference to function template instantiation 'OutIt std::copy<T,T
>(_InIt,_InIt,_OutIt)' being compiled
2> with
2> [
2> OutIt=const fmt::BasicFormatter::Arg *,
2> T=const fmt::BasicFormatter::Arg _,
2> InIt=const fmt::BasicFormatter::Arg *
2> ]
2> M:\mmgit\mmcyb\inc\format.h(103) : while compiling class template member function 'void fmt::internal::Array<T,SIZE>::Grow(size_t)'
2> with
2> [
2> T=const fmt::BasicFormatter::Arg _,
2> SIZE=10
2> ]
2> M:\mmgit\mmcyb\inc\format.h(977) : see reference to class template instantiation 'fmt::internal::Array<T,SIZE>' being compiled
2> with
2> [
2> T=const fmt::BasicFormatter::Arg ,
2> SIZE=10
2> ]
2>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xutility(2813): warning C4996: 'std::_Fill_n': Function call with parameters that may be unsafe - this call relies on the caller to check that the passed values are correct. To disable this warning, use -D_SCL_SECURE_NO_WARNINGS. See documentation on how to use Visual C++ 'Checked Iterators'
2> C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xutility(2799) : see declaration of 'std::Fill_n'
2> M:\mmgit\mmcyb\inc\format.h(1508) : see reference to function template instantiation 'void std::fill_n<char
,unsigned int,char>(_OutIt,_Diff,const _Ty &)' being compiled
2> with
2> [
2> _OutIt=char _,
2> _Diff=unsigned int,
2> _Ty=char
2> ]
2> M:\mmgit\mmcyb\inc\format.h(1326) : while compiling class template member function 'void fmt::BasicFormatter::DoFormat(void)'
2> with
2> [
2> Char=char
2> ]
2>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xutility(2239): warning C4996: 'std::_Copy_impl': Function call with parameters that may be unsafe - this call relies on the caller to check that the passed values are correct. To disable this warning, use -D_SCL_SECURE_NO_WARNINGS. See documentation on how to use Visual C++ 'Checked Iterators'
2> C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xutility(2224) : see declaration of 'std::_Copy_impl'
2> M:\mmgit\mmcyb\inc\format.h(117) : see reference to function template instantiation 'OutIt std::copy<const T,T
>(_InIt,_InIt,_OutIt)' being compiled
2> with
2> [
2> _OutIt=char *,
2> T=char,
2> _InIt=const char *
2> ]
2> M:\mmgit\mmcyb\inc\format.h(113) : while compiling class template member function 'void fmt::internal::Array<T,SIZE>::append(const T *,const T *)'
2> with
2> [
2> T=char,
2> SIZE=500
2> ]
2>Link:
2> test_strings.vcxproj -> D:\cybadev\Test\test_strings\Win32\Debug\test_strings.exe
2>FinalizeBuildStatus:
2> Deleting file "Debug\test_strings.unsuccessfulbuild".
2> Touching "Debug\test_strings.lastbuildstate".
2>
2>Build succeeded.

@justnom
Copy link

justnom commented Apr 22, 2013

As the warning says function call with parameters that MAY be unsafe.
You can ignore the warning in two ways:

  1. Add #define _SCL_SECURE_NO_WARNINGS into your code.
  2. Right click on your project in the Solution Explorer. Click Properties. In the left hand tree click C/C++ then go into the Preprocessor pane. Click on the Prepprocessor Definitions and add the definition _SCL_SECURE_NO_WARNINGS. Remember to also do this to all your configurations.

Both of the above solutions achieve the same goal.

@vitaut
Copy link
Contributor

vitaut commented Apr 22, 2013

Fixed the compilation issue when windows.h is included in 6da2c53

I'll think what to do with the warnings, for now you can disable them as suggested by justnom.

Thanks.

@vitaut
Copy link
Contributor

vitaut commented Sep 3, 2013

Fixed warnings by using checked iterators when _SECURE_SCL is set. Closing the issue.

@vitaut vitaut closed this as completed Sep 3, 2013
vitaut pushed a commit that referenced this issue Mar 14, 2018
@cppden cppden mentioned this issue Jul 17, 2018
DanielaE referenced this issue in DanielaE/fmt Sep 30, 2018
DanielaE referenced this issue in DanielaE/fmt Sep 30, 2018
DanielaE referenced this issue in DanielaE/fmt Oct 1, 2018
DanielaE referenced this issue in DanielaE/fmt Oct 1, 2018
DanielaE referenced this issue in DanielaE/fmt Oct 1, 2018
Take #2 of n

Signed-off-by: Daniela Engert <dani@ngrt.de>
DanielaE referenced this issue in DanielaE/fmt Oct 1, 2018
Take #2 of n

Signed-off-by: Daniela Engert <dani@ngrt.de>
DanielaE referenced this issue in DanielaE/fmt Oct 1, 2018
DanielaE referenced this issue in DanielaE/fmt Oct 2, 2018
DanielaE referenced this issue in DanielaE/fmt Oct 2, 2018
DanielaE referenced this issue in DanielaE/fmt Oct 2, 2018
Take #2 of n

Signed-off-by: Daniela Engert <dani@ngrt.de>
DanielaE referenced this issue in DanielaE/fmt Oct 2, 2018
DanielaE referenced this issue in DanielaE/fmt Oct 2, 2018
Take #2 of n

Signed-off-by: Daniela Engert <dani@ngrt.de>
DanielaE referenced this issue in DanielaE/fmt Oct 2, 2018
Take #2 of n

Signed-off-by: Daniela Engert <dani@ngrt.de>
DanielaE referenced this issue in DanielaE/fmt Oct 3, 2018
Take #2 of n

Signed-off-by: Daniela Engert <dani@ngrt.de>
vitaut pushed a commit that referenced this issue Oct 3, 2018
Take #2 of n

Signed-off-by: Daniela Engert <dani@ngrt.de>
rimathia pushed a commit to rimathia/fmt that referenced this issue Sep 20, 2020
Support out-of-source builds
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants