-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
not enough actual parameters for macro 'min' #1180
Comments
I fixed this in commit 6e38649. If you can't switch to that or newer, try defining NOMINMAX on the command line (e.g., passing |
I finally got a chance to check which version I'm using. I'm getting this from vcpkg. From rapidjson.h:
which according to https://repology.org/metapackage/rapidjson/versions and this GitHub repo, is the latest released version. I tried using /DNOMINMAX on the CL command line, but got: 1>c:\program files (x86)\microsoft sdks\windows\v7.1a\include\gdiplustypes.h(470): error C3861: 'min': identifier not found The 1.1 version was released on Aug 25, 2016. Seems like it's been a while. Any idea of when the next version will be released? |
(Also, if you'd like to temporarily use the latest master until there's an update, you can use |
When I tried switching to the 64 bit configuration, I started getting this error: C2039 'GetObjectW': is not a member of 'rapidjson::GenericValue<rapidjson::UTF8,rapidjson::MemoryPoolAllocatorrapidjson::CrtAllocator>' CouloirAFX-WinW c:\dev\couloir\generic\afx\mvc\couloirafx\modeldata.cpp 112
I tried getting the latest, as Robert suggested, but it was the same. Not sure how I ended up with this crazy looking code, but it builds and runs correctly in 32 bit mode. Thoughts? |
I looked through all the revisions of document.h in the repository from 8022a5f all the way back to 8f8e905 (the initial import from the SVN repository). None of these revisions to document.h have a This looks like a collision between the Win32 GDI function Explicit use of My guess is that the 32- and 64-bit configurations have differing values for I bet you can work around this issue by temporarily undef'ing the void ModelData::process( XmlNode parent, GenericValue<UTF8<>>* json )
{
String Value;
if( json->IsObject() )
{
#pragma push_macro("GetObject")
#undef GetObject
process( parent, json->GetObject() );
#pragma pop_macro("GetObject")
}
... Another option: if the compilation unit using For the Failing all of that, you should be able to work around this by using the same #pragma push_macro("min")
#pragma push_macro("max")
#undef min
#undef max
#include <rapidjson/rapidjson.h> // or whatever headers
#pragma pop_macro("min")
#pragma pop_macro("max") Of course, with all of these approaches, you'll need to make sure you define the relevant macros & such before the header gets included for the first time. Watch out for precompiled headers and similar patterns. |
I truly appreciate your help. My Saga:
To: WEB;SPDLOG_FMT_EXTERNAL;_NO_ASYNCRTIMP;_NO_PPLXIMP;PUGIXML_WCHAR_MODE;PUGIXML_NO_EXCEPTIONS;SPDLOG_WCHAR_FILENAMES;BOOST_LIB_DIAGNOSTIC;_WINDOWS;_UNICODE;UNICODE;_USRDLL;_DEBUG; 44>c:\dev\couloir\3plibs\vcpkg\installed\x64\include\rapidjson\document.h(964): error C2589: '(': illegal token on right side of '::'
1>c:\dev\couloir\generic\afx\mvc\couloirafx\modeldata.cpp(114): error C2039: 'GetObject': is not a member of 'rapidjson::GenericValue<rapidjson::UTF8,rapidjson::MemoryPoolAllocatorrapidjson::CrtAllocator>'
Same error on line 114
Same error on line 114
Same error on line 114
Peace broke out. Lions laid down with the lamb. Hatfields & McCoys became friends. Sun rose on a beautiful day, birds chirping, children played in complete safety. No one knew that the people responsible for including c preprocessor MACROS in C++, but insisting with an evil smirk that they should not obey NameSpace rules, were taken out and shot. No trial, no defense attorneys to argue about the intricacies of C++ history or cpp standardese. They were just shot & their bodies sunk to the bottom of the Marianas trench. And the world lived happily ever after... |
Deliberately choosing to name functions the same as ubiquitous MACRO names is not helpful. Similarly, when std::committee decided on std::max, MS should have done a global search & replace from MAX to MS_MAXIMUM... |
Updated to latest in vcpkg & again changed: FROM: static ObjectType Get(ValueType& v) { return v.GetObject(); } Because life is too short to be stubborn about using a name that causes other people lots and lots of problems. I'm a rude person, but I don't go out of my way to cause complete strangers pain. |
Similar to 984 except that I'm defining NOMINMAX:
My code includes document.h in only two places, and both are like the above. I turned on Show Includes:
The text was updated successfully, but these errors were encountered: