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

picojson.h compile error #5

Closed
Clinkz24 opened this issue Aug 16, 2018 · 2 comments
Closed

picojson.h compile error #5

Clinkz24 opened this issue Aug 16, 2018 · 2 comments

Comments

@Clinkz24
Copy link

d:\workspace\trd\curl-7.61.0\projects\windows\vc14\curl_test\jwt-cpp\picojson.h(895): warning C4003: not enough actual parameters for macro 'min'
1>d:\workspace\trd\curl-7.61.0\projects\windows\vc14\curl_test\jwt-cpp\picojson.h(895): warning C4003: not enough actual parameters for macro 'max'
1>d:\workspace\trd\curl-7.61.0\projects\windows\vc14\curl_test\jwt-cpp\picojson.h(895): error C2589: '(': illegal token on right side of '::'
1> d:\workspace\trd\curl-7.61.0\projects\windows\vc14\curl_test\jwt-cpp\picojson.h(1066): note: see reference to function template instantiation 'bool picojson::_parse<Context,Iter>(Context &,picojson::input &)' being compiled
1> with
1> [
1> Context=picojson::default_parse_context,
1> Iter=std::_String_const_iterator<std::_String_val<std::_Simple_types>>
1> ]
1> d:\workspace\trd\curl-7.61.0\projects\windows\vc14\curl_test\jwt-cpp\picojson.h(1084): note: see reference to function template instantiation 'Iter picojson::_parsepicojson::default_parse_context,Iter(Context &,const Iter &,const Iter &,std::string *)' being compiled
1> with
1> [
1> Iter=std::_String_const_iterator<std::_String_val<std::_Simple_types>>,
1> Context=picojson::default_parse_context
1> ]
1> d:\workspace\trd\curl-7.61.0\projects\windows\vc14\curl_test\jwt-cpp\picojson.h(1089): note: see reference to function template instantiation 'Iter picojson::parse<std::_String_const_iterator<std::_String_val<std::_Simple_types>>>(picojson::value &,const Iter &,const Iter &,std::string *)' being compiled
1> with
1> [
1> Iter=std::_String_const_iterator<std::_String_val<std::_Simple_types>>
1> ]
1>d:\workspace\trd\curl-7.61.0\projects\windows\vc14\curl_test\jwt-cpp\picojson.h(895): error C2059: syntax error: '::'
1>d:\workspace\trd\curl-7.61.0\projects\windows\vc14\curl_test\jwt-cpp\picojson.h(896): error C2143: syntax error: missing ';' before '{'
1>d:\workspace\trd\curl-7.61.0\projects\windows\vc14\curl_test\jwt-cpp\picojson.h(902): error C2065: 'f': undeclared identifier
1>d:\workspace\trd\curl-7.61.0\projects\windows\vc14\curl_test\jwt-cpp\picojson.h(902): error C2065: 'num_str': undeclared identifier
1>d:\workspace\trd\curl-7.61.0\projects\windows\vc14\curl_test\jwt-cpp\picojson.h(902): error C2228: left of '.c_str' must have class/struct/union
1> d:\workspace\trd\curl-7.61.0\projects\windows\vc14\curl_test\jwt-cpp\picojson.h(902): note: type is 'unknown-type'
1>d:\workspace\trd\curl-7.61.0\projects\windows\vc14\curl_test\jwt-cpp\picojson.h(902): error C2065: 'endp': undeclared identifier
1>d:\workspace\trd\curl-7.61.0\projects\windows\vc14\curl_test\jwt-cpp\picojson.h(903): error C2065: 'endp': undeclared identifier
1>d:\workspace\trd\curl-7.61.0\projects\windows\vc14\curl_test\jwt-cpp\picojson.h(903): error C2065: 'num_str': undeclared identifier
1>d:\workspace\trd\curl-7.61.0\projects\windows\vc14\curl_test\jwt-cpp\picojson.h(903): error C2228: left of '.c_str' must have class/struct/union
1> d:\workspace\trd\curl-7.61.0\projects\windows\vc14\curl_test\jwt-cpp\picojson.h(903): note: type is 'unknown-type'
1>d:\workspace\trd\curl-7.61.0\projects\windows\vc14\curl_test\jwt-cpp\picojson.h(903): error C2228: left of '.size' must have class/struct/union
1> d:\workspace\trd\curl-7.61.0\projects\windows\vc14\curl_test\jwt-cpp\picojson.h(903): note: type is 'unknown-type'
1>d:\workspace\trd\curl-7.61.0\projects\windows\vc14\curl_test\jwt-cpp\picojson.h(904): error C2065: 'f': undeclared identifier
1>d:\workspace\trd\curl-7.61.0\projects\windows\vc14\curl_test\jwt-cpp\picojson.h(909): error C2043: illegal break
1>d:\workspace\trd\curl-7.61.0\projects\windows\vc14\curl_test\jwt-cpp\picojson.h(911): error C3927: '->': trailing return type is not allowed after a non-function declarator
1>d:\workspace\trd\curl-7.61.0\projects\windows\vc14\curl_test\jwt-cpp\picojson.h(911): error C3484: syntax error: expected '->' before the return type
1>d:\workspace\trd\curl-7.61.0\projects\windows\vc14\curl_test\jwt-cpp\picojson.h(911): error C3613: missing return type after '->' ('int' assumed)
1>d:\workspace\trd\curl-7.61.0\projects\windows\vc14\curl_test\jwt-cpp\picojson.h(911): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>d:\workspace\trd\curl-7.61.0\projects\windows\vc14\curl_test\jwt-cpp\picojson.h(911): error C2146: syntax error: missing ';' before identifier 'ungetc'
1>d:\workspace\trd\curl-7.61.0\projects\windows\vc14\curl_test\jwt-cpp\picojson.h(912): error C2059: syntax error: 'return'
1>d:\workspace\trd\curl-7.61.0\projects\windows\vc14\curl_test\jwt-cpp\picojson.h(913): error C2059: syntax error: '}'
1>d:\workspace\trd\curl-7.61.0\projects\windows\vc14\curl_test\jwt-cpp\picojson.h(913): error C2143: syntax error: missing ';' before '}'
1>d:\workspace\vs2015\vc\include\xutility(2982): error C2143: syntax error: missing ';' before '{'
1>d:\workspace\vs2015\vc\include\xutility(2982): error C2447: '{': missing function header (old-style formal list?)

@Thalhammer
Copy link
Owner

Sorry for the late reply.

I see you're on a windows system, so I assume you include windows.h either directly or indirectly.
Windows.h (windef.h to be more specific) defines min() and max() as preprocessor macros which collide with std::numeric_limits. So you have three options:

  • define NOMINMAX, which suppresses this behaviour
  • include this library before you include windows.h
  • place #undef max and #undef min before you include this library
    Please respond if this solved it.

@Clinkz24
Copy link
Author

hi, I tried three ways you said it. They all compile correctly.
Thanks :)

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

2 participants