c++ 모호한 기호입니다. 라고 오류가 떠요...

pentas의 이미지

'move' 가 모호한 기호입니다. 라고 뜨는데 어떻게 해야하나요??
move는 stuct offsets 이고

오류나는 부분은 void path() 에 잇는
int g = i + move[d].a;
int h = j + move[d].b;

이 부분입니다.

#include <iostream>
#include <stack>
using namespace std;
const int MAXSIZE=100; // up to 100 by 100 maze allowed
bool maze[MAXSIZE+2][MAXSIZE+2] = { 0 } ;
bool mark[MAXSIZE+1][MAXSIZE+1] = { 0 } ;
 
enum directions { N, NE, E, SE, S, SW, W, NW };
struct offsets
{
   int a, b;
} move[8] = { -1,0,  -1,1,  0,1,  1,1,  1,0,  1,-1,  0,-1,  -1,-1 };
struct Items {
   Items(int xx=0, int yy=0, int dd=0): x(xx), y(yy), dir(dd) {}
   int x, y, dir;
};
 
template <class T>
ostream& operator<< (ostream& os, stack<T>& s) {
		 // 스택의 내용을 역순으로 출력
         // 구현방법=내용을 하나씩 꺼내 다른 임시 스택에 넣어 저장한 
         // 후, 최종적으로 그 임시 스택에서 하나씩 꺼내 출력하면 됨
	os<<""top=<<s.top<<endl;
	for(int i=0;i<=s.top;i++)
		os<<i<<":"<<s.stack[i]<<endl;
 
	stack<T> s2;
 
	while(!s.empty()) {
		s2.push(s.top());
		s.pop();      }
	while(!s2.empty()) {
		os<<"->"<<s2.top();}
   return os;
}
ostream& operator<<(ostream& os, Items& item)
{
   static int count = 0; // 5개의 Items가 출력될 때마다 줄바꾸기위해
   os << "(" << item.x << "," << item.y << ")";
   count++; if ((count % 5) == 0) cout << endl;
   return os;
}
void Path(const int m, const int p)
{
  mark[1][1] = 1; 
  stack<Items> stack; // C++ STD stack을 이용하라
  Items temp(1, 1, E);
  stack.push(temp);
 
  while (!stack.empty())
  {
	  temp = stack.top();
	  stack.pop();
	  int i= temp.x; int j= temp.y; int d = temp.dir;
 
	  while(d<8) // 앞으로 이동
	  {
		  int g = i + move[d].a;
		  int h = j + move[d].b;
		  if((g==m)&&(h==p)){//출구도착
			  cout << stack;
			  temp.x = i; temp.y = j; cout << " -> " << temp;
			  temp.x = m; temp.y = p; cout << " -> " << temp << endl;
			  return;
		  }
		  if((!maze[g][h])&&(!mark[g][h]))
		  {
			  mark[g][h]=1;
			  temp.x=i; temp.y=j; temp.dir=d+1;
			  stack.push(temp);			//스택에 삽입
			  i=g; j=h; d=N;			//(g,h)로 이동
		  }
		  else d++;			//다음방향으로 시도
	  }		//end of while(d<8)
  }		//end of while(!stack.empty())
  cout<<"No path in maze."<<endl;
}
void getdata(istream& is, int& m, int & p)
{ // 자료화일을 읽어들여 maze에 저장한다.
   is >> m >> p;
   for (int i = 0; i < m+2; i++) { maze[i][0] = 1; maze[i][p+1] = 1; }
   for (int j = 1; j <= p; j++) { maze[0][j] = 1; maze[m+1][j] = 1; }
   for (int i = 1; i <= m; i++)
      for (int j = 1; j <= p; j++)
         is >> maze[i][j];
}
snowall의 이미지

offsets 구조체 선언에서 선언 후 사용을 바로 해도 되나요?

피할 수 있을때 즐겨라! http://melotopia.net/b

HDNua의 이미지

move가 이미 매크로나 함수 같은 거로 정의가 되어있네요.
저거만 바꾸시면 해결되지 않을까 하는데 아닌가요?

댓글 첨부 파일: 
첨부파일 크기
Image icon Untitled.png92.12 KB

저는 이렇게 생각했습니다.

klyx의 이미지

move를 ::move로 바꿔보세요. 그리고 다음부터는 정확한 에러메시지를(출력된 에러를 그대로) 첨부해주세요.

winner의 이미지

using namespace std 가 있는 것을 보니 최신의 compiler 를 사용한 대가(?)가 아닐까요?

댓글 달기

Filtered HTML

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

BBCode

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param>
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

Textile

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • You can use Textile markup to format text.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Markdown

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • Quick Tips:
    • Two or more spaces at a line's end = Line break
    • Double returns = Paragraph
    • *Single asterisks* or _single underscores_ = Emphasis
    • **Double** or __double__ = Strong
    • This is [a link](http://the.link.example.com "The optional title text")
    For complete details on the Markdown syntax, see the Markdown documentation and Markdown Extra documentation for tables, footnotes, and more.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Plain text

  • HTML 태그를 사용할 수 없습니다.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 줄과 단락은 자동으로 분리됩니다.
댓글 첨부 파일
이 댓글에 이미지나 파일을 업로드 합니다.
파일 크기는 8 MB보다 작아야 합니다.
허용할 파일 형식: txt pdf doc xls gif jpg jpeg mp3 png rar zip.
CAPTCHA
이것은 자동으로 스팸을 올리는 것을 막기 위해서 제공됩니다.