[Solved] Following c++ code works in leetcode but not in my vscode, why?

LuCC Asks: Following c++ code works in leetcode but not in my vscode, why?
I am currently working on a leetcode question, and try to track down the code process in my end, this is my solution:

#include <iostream>
#include <vector>
#include <stack>
#include <utility>

using namespace std;

vector<int> direction{-1, 0, 1, 0, -1};

int maxAreaOfIsland(vector<vector<int>>&grid){

  int m = grid.size(), n = m ? grid[0].size() : 0, local_area, area = 0, x, y;
  for (int i = 0; i < m; ++i){

    for (int j = 0; j < n; ++j){

        local_area = 1;
        grid[i][j] = 0;
        stack<pair<int, int>> island;
        island.push({i, j});
          auto [r, c] = island.top(); \problem line, vscode can't understand it
          for (int k = 0; k < 4; ++k){
            x = r + direction[k], y = c + direction[k + 1];
            if(x>=0 && x<m && y>=0 && y<n && grid[x][y]==1){
              grid[x][y] = 0;
              island.push({x, y});
        area = max(area, local_area);


  return area;

this code works on the leetcode side, but not mine, here is the warning

[Running] cd "c:Userschen1OneDriveDesktopC_C++tut" && g++ leetcode695.cpp -o leetcode695 && "c:Userschen1OneDriveDesktopC_C++tut"leetcode695
leetcode695.cpp: In function 'int maxAreaOfIsland(std::vector<std::vector<int> >&)':
leetcode695.cpp:23:16: warning: structured bindings only available with -std=c++17 or -std=gnu++17
           auto [r, c] = island.top();
C:/Program Files/mingw-w64/x86_64-8.1.0-posix-seh-rt_v6-rev0/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/lib/../lib/libmingw32.a(lib64_libmingw32_a-crt0_c.o):crt0_c.c:(.text.startup+0x2e): undefined reference to `WinMain'
collect2.exe: error: ld returned 1 exit status

[Done] exited with code=1 in 0.932 seconds

Can someone explains why, although I get an alternative way to replace it, it is still annoying and perplexing

thanks for helping

Ten-tools.com may not be responsible for the answers or solutions given to any question asked by the users. All Answers or responses are user generated answers and we do not have proof of its validity or correctness. Please vote for the answer that helped you in order to help others find out which is the most helpful answer. Questions labeled as solved may be solved or may not be solved depending on the type of question and the date posted for some posts may be scheduled to be deleted periodically. Do not hesitate to share your response here to help other visitors like you. Thank you, Ten-tools.