From 1eeb4c85a120b23b853aabb8e6cf984b03dbc17f Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Fri, 14 May 2021 10:36:29 -0400 Subject: SL-15258: No 'using namespace std' with Windows SDK With /std:c++17, in wbemcli.h included by , we were getting errors concerning an ambiguous symbol 'byte'. This turns out to be due to a 'using namespace std' declaration before the #include. The linked workaround advises moving 'using namespace std' after the #include. But since the ONLY symbol from std that was used without qualification was 'hex' in a few places, remove 'using namespace std' altogether and just write 'std::hex' everywhere. https://developercommunity.visualstudio.com/t/error-c2872-byte-ambiguous-symbol/93889#T-N138537 --- indra/newview/llmachineid.cpp | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llmachineid.cpp b/indra/newview/llmachineid.cpp index 57a6ecb604..1810105b42 100644 --- a/indra/newview/llmachineid.cpp +++ b/indra/newview/llmachineid.cpp @@ -30,7 +30,6 @@ #if LL_WINDOWS #define _WIN32_DCOM #include -using namespace std; #include #include #endif @@ -47,7 +46,7 @@ public: { mHR = CoInitializeEx(0, COINIT_MULTITHREADED); if (FAILED(mHR)) - LL_DEBUGS("AppInit") << "Failed to initialize COM library. Error code = 0x" << hex << mHR << LL_ENDL; + LL_DEBUGS("AppInit") << "Failed to initialize COM library. Error code = 0x" << std::hex << mHR << LL_ENDL; } ~LLComInitialize() @@ -105,7 +104,7 @@ S32 LLMachineID::init() if (FAILED(hres)) { - LL_WARNS("AppInit") << "Failed to initialize security. Error code = 0x" << hex << hres << LL_ENDL; + LL_WARNS("AppInit") << "Failed to initialize security. Error code = 0x" << std::hex << hres << LL_ENDL; return 1; // Program has failed. } @@ -122,7 +121,7 @@ S32 LLMachineID::init() if (FAILED(hres)) { - LL_WARNS("AppInit") << "Failed to create IWbemLocator object." << " Err code = 0x" << hex << hres << LL_ENDL; + LL_WARNS("AppInit") << "Failed to create IWbemLocator object." << " Err code = 0x" << std::hex << hres << LL_ENDL; return 1; // Program has failed. } @@ -147,7 +146,7 @@ S32 LLMachineID::init() if (FAILED(hres)) { - LL_WARNS("AppInit") << "Could not connect. Error code = 0x" << hex << hres << LL_ENDL; + LL_WARNS("AppInit") << "Could not connect. Error code = 0x" << std::hex << hres << LL_ENDL; pLoc->Release(); return 1; // Program has failed. } @@ -171,7 +170,7 @@ S32 LLMachineID::init() if (FAILED(hres)) { - LL_WARNS("AppInit") << "Could not set proxy blanket. Error code = 0x" << hex << hres << LL_ENDL; + LL_WARNS("AppInit") << "Could not set proxy blanket. Error code = 0x" << std::hex << hres << LL_ENDL; pSvc->Release(); pLoc->Release(); return 1; // Program has failed. @@ -191,7 +190,7 @@ S32 LLMachineID::init() if (FAILED(hres)) { - LL_WARNS("AppInit") << "Query for operating system name failed." << " Error code = 0x" << hex << hres << LL_ENDL; + LL_WARNS("AppInit") << "Query for operating system name failed." << " Error code = 0x" << std::hex << hres << LL_ENDL; pSvc->Release(); pLoc->Release(); return 1; // Program has failed. @@ -219,7 +218,7 @@ S32 LLMachineID::init() hr = pclsObj->Get(L"SerialNumber", 0, &vtProp, 0, 0); if (FAILED(hr)) { - LL_WARNS() << "Failed to get SerialNumber. Error code = 0x" << hex << hres << LL_ENDL; + LL_WARNS() << "Failed to get SerialNumber. Error code = 0x" << std::hex << hres << LL_ENDL; pclsObj->Release(); pclsObj = NULL; continue; -- cgit v1.2.3