Score:0

problem in running c++ 17 code

it flag

With these two commands sudo apt-get update sudo apt install build-essential I install c++ compiler and it has GCC/g++ version 10,than I install VS-Code and install two extensions code-runner and c++ extension by Microsoft, it runs this code

#include <iostream>
using namespace std;
int main(){
    cout<<"hello world";
    return 0;
}

But not this c++17 specific code

#include <array>
#include <iostream>
#include <string_view>
#include <tuple>
#include <type_traits>

namespace a::b::c
{
    inline constexpr std::string_view str{ "hello" };
}

template <class... T>
std::tuple<std::size_t, std::common_type_t<T...>> sum(T... args)
{
    return { sizeof...(T), (args + ...) };
}

int main()
{
    auto [iNumbers, iSum]{ sum(1, 2, 3) };
    std::cout << a::b::c::str << ' ' << iNumbers << ' ' << iSum << '\n';

    std::array arr{ 1, 2, 3 };

    std::cout << std::size(arr) << '\n';

    return 0;
}

kindly help me to solve this issue Thanks in anticipation

hr flag
You likely need to add the `-std=c++17` compiler option. See for example [How to include compiler flags in Visual Studio Code?](https://stackoverflow.com/questions/57173093/how-to-include-compiler-flags-in-visual-studio-code)
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.