Language: C++

#include <bits/stdc++.h>
using namespace std;

struct Point{
	int h,w;
	Point(){};
	Point(int h_,int w_){
		h=h_,w=w_;
	};
};

Point operator+(const Point& a,const Point& b){return Point(a.h+b.h,a.w+b.w);}

struct Board{

	int H,W;
	vector<string>s ;
	vector<Point>near;
	queue<Point> que;
	vector<vector<int>> dist;

	Board(){};
	Board(int h_,int w_){
		H=h_,W=w_;
		s.resize(h);
		near={{-1,0},{1,0},{0,-1},{0,1}};
		dist.resize(H,vector<int>(W,-1));
	};

	bool in_board(Point p){if(0<=p.h && p.h<H && 0<=p.w< && p.w<W)return true;else return false;} 
	char get_char(Point p){return s[p.h][p.w];}
	int  get_dist(Point p){return dist[p.h][p.w];}
	int  set_dist(Point p,int i){dist[p.h][p.w]=i;}


	void bfs(){
		while(! que.empty()){
		Point p=que.front();p.pop();	
		for(auto&& u:near){
		Point q=p+u;
		if(in_board(q) && get_char(q)=='.' &&get_dist(q)==-1){
			set_dist(q,get_dist(p)+1);
			que.push(q);
		}
	void do_all_bfs(){for (int i;i<H;i++)for(int j=0;j<W;j++){
		Point p(i,j);
		if(get_dist(p)==-1){
			que.push(p);bfs();
		}
	}
}}
	

};


int main(){
	int h,w;cin>>h>>w;
	Board bd(h,w);
	for(auto&& u:bd.s)cin>>u;
	for(auto&& u:bd.s)cout<<u<<endl;
	bd.do_all_bfs();

}

Compiler output:
a.cc:64:2: error: expected '}' at end of input
   64 | }
      |  ^
a.cc:14:13: note: to match this '{'
   14 | struct Board{
      |             ^
a.cc: In constructor 'Board::Board(int, int)':
a.cc:25:26: error: 'h' was not declared in this scope; did you mean 'h_'?
   25 |                 s.resize(h);
      |                          ^
      |                          h_
a.cc: In member function 'bool Board::in_board(Point)':
a.cc:30:60: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   30 |         bool in_board(Point p){if(0<=p.h && p.h<H && 0<=p.w< && p.w<W)return true;else return false;}
      |                                                      ~~~~~~^~~~~~
a.cc:30:66: error: expected ')' before '.' token
   30 |         bool in_board(Point p){if(0<=p.h && p.h<H && 0<=p.w< && p.w<W)return true;else return false;}
      |                                                                  ^
a.cc:30:34: note: to match this '('
   30 |         bool in_board(Point p){if(0<=p.h && p.h<H && 0<=p.w< && p.w<W)return true;else return false;}
      |                                  ^
a.cc:30:65: error: label 'p' used but not defined
   30 |         bool in_board(Point p){if(0<=p.h && p.h<H && 0<=p.w< && p.w<W)return true;else return false;}
      |                                                                 ^
a.cc: In member function 'int Board::set_dist(Point, int)':
a.cc:33:55: warning: no return statement in function returning non-void [-Wreturn-type]
   33 |         int  set_dist(Point p,int i){dist[p.h][p.w]=i;}
      |                                                       ^
a.cc: In member function 'void Board::bfs()':
a.cc:38:39: error: 'struct Point' has no member named 'pop'
   38 |                 Point p=que.front();p.pop();
      |                                       ^~~
a.cc:45:26: error: a function-definition is not allowed here before '{' token
   45 |         void do_all_bfs(){for (int i;i<H;i++)for(int j=0;j<W;j++){
      |                          ^
a.cc:57:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
   57 | int main(){
      |         ^~
a.cc:57:9: note: remove parentheses to default-initialize a variable
   57 | int main(){
      |         ^~
      |         --
a.cc:57:9: note: or replace parentheses with braces to value-initialize a variable
a.cc:57:11: error: a function-definition is not allowed here before '{' token
   57 | int main(){
      |           ^
a.cc:64:2: error: expected '}' at end of input
   64 | }
      |  ^
a.cc:36:19: note: to match this '{'
   36 |         void bfs(){
      |                   ^
a.cc: At global scope:
a.cc:64:2: error: expected unqualified-id at end of input
   64 | }
      |  ^