-
August 21st, 2022, 04:22 AM
#1
VS2019 and C++17 ?
I'm building a 3rd party program here using VS2019. One of the header files contains this code:-
Code:
namespace MIDI::Name { // <--- NOTE THIS LINE !!!
class MasterDeviceNames;
class CustomDeviceMode;
struct PatchPrimaryKey;
}
VS2019 gives me:- language feature 'nested-namespace-definition' requires compiler flag '/std:c++17'
So I added /std:c++17 to the compiler's Additional Options but all that did was to produce extra errors - such as auto_ptr: is not a member of 'std'
Is there a better way for me to specify that compiler option? Or isn't C++17 fully supported in VS2019?
"A problem well stated is a problem half solved.” - Charles F. Kettering
-
August 21st, 2022, 06:23 AM
#2
Re: VS2019 and C++17 ?
VS2019 is C++17 compliant.
To set to compile for C++17, Project/Properties/Configuration/General/C++ Language standard. Set to the one required. You then don't need to explicitly use /std:c++17
Note that auto_ptr was removed in C++17 - so can't be used if compiling to that standard. You'll need to modify the code to use eg std::unique_ptr
https://en.cppreference.com/w/cpp/memory/auto_ptr
All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!
C++23 Compiler: Microsoft VS2022 (17.6.5)
-
August 21st, 2022, 08:02 AM
#3
Re: VS2019 and C++17 ?
That's great 2kaud, many thanks...
"A problem well stated is a problem half solved.” - Charles F. Kettering
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|