busyhuman   8년 전

제출을 했더니 컴파일에러가 수두룩 뜹니다..

무엇이 잘못된건가요 ?


######################

Main.cc:9:19: error: ISO C++ forbids initialization of member ‘character’ [-fpermissive]
Main.cc:9:19: error: making ‘character’ static [-fpermissive]
Main.cc:9:19: error: ISO C++ forbids in-class initialization of non-const static member ‘character’
Main.cc:9:19: warning: converting to non-pointer type ‘char’ from NULL [-Wconversion-null]
Main.cc:10:15: error: ISO C++ forbids initialization of member ‘next’ [-fpermissive]
Main.cc:10:15: error: making ‘next’ static [-fpermissive]
Main.cc:10:15: error: invalid in-class initialization of static data member of non-integral type ‘List*’
Main.cc:11:14: error: ISO C++ forbids initialization of member ‘pre’ [-fpermissive]
Main.cc:11:14: error: making ‘pre’ static [-fpermissive]
Main.cc:11:14: error: invalid in-class initialization of static data member of non-integral type ‘List*’
Main.cc: In function ‘void printList()’:
Main.cc:22:26: warning: NULL used in arithmetic [-Wpointer-arith]
Main.cc:23:18: error: ‘class List’ has no member named ‘next’
Main.cc:29:19: error: ‘class List’ has no member named ‘next’
Main.cc:34:21: warning: converting to non-pointer type ‘char’ from NULL [-Wconversion-null]
Main.cc: In function ‘void moveLeft()’:
Main.cc:40:30: error: ‘class List’ has no member named ‘pre’
Main.cc:43:17: error: ‘class List’ has no member named ‘pre’
Main.cc: In function ‘void moveRight()’:
Main.cc:48:30: error: ‘class List’ has no member named ‘next’
Main.cc:51:17: error: ‘class List’ has no member named ‘next’
Main.cc: In function ‘void Push(char*)’:
Main.cc:61:10: error: ‘class List’ has no member named ‘next’
Main.cc:62:10: error: ‘class List’ has no member named ‘pre’
Main.cc:65:6: error: ‘class List’ has no member named ‘next’
Main.cc:65:20: error: ‘class List’ has no member named ‘next’
Main.cc:66:6: error: ‘class List’ has no member named ‘next’
Main.cc:67:6: error: ‘class List’ has no member named ‘pre’
Main.cc:68:10: error: ‘class List’ has no member named ‘next’
Main.cc:69:18: error: ‘class List’ has no member named ‘next’
Main.cc:72:14: error: ‘class List’ has no member named ‘next’
Main.cc:73:7: error: ‘class List’ has no member named ‘next’
Main.cc:76:7: error: ‘class List’ has no member named ‘next’
Main.cc:76:21: error: ‘class List’ has no member named ‘next’
Main.cc:77:7: error: ‘class List’ has no member named ‘next’
Main.cc:79:7: error: ‘class List’ has no member named ‘pre’
Main.cc:80:11: error: ‘class List’ has no member named ‘next’
Main.cc:81:19: error: ‘class List’ has no member named ‘next’
Main.cc: In function ‘void Pop()’:
Main.cc:92:17: error: ‘class List’ has no member named ‘pre’
Main.cc:99:14: error: ‘class List’ has no member named ‘next’
Main.cc:100:11: error: ‘class List’ has no member named ‘next’
Main.cc:100:21: error: ‘class List’ has no member named ‘next’
Main.cc:101:11: error: ‘class List’ has no member named ‘next’
Main.cc:104:11: error: ‘class List’ has no member named ‘next’
Main.cc:109:10: error: ‘class List’ has no member named ‘next’
Main.cc:110:11: error: ‘class List’ has no member named ‘next’
Main.cc:113:11: error: ‘class List’ has no member named ‘next’
Main.cc:113:21: error: ‘class List’ has no member named ‘next’
Main.cc:114:7: error: ‘class List’ has no member named ‘next’

#############################

baekjoon   8년 전

c++11에서는 next 라는 변수명을 사용할 수 없습니다.

busyhuman   8년 전

@baekjoon 그냥 C++로 했었는데 에러가 났습니다

ntopia   8년 전

c++ 문법에서는

구조체 멤버를 선언하면서 바로 초기값을 대입할 수 없어요

생성자 함수를 만들어서 거기에서 초기값을 대입해주세요

ntopia   8년 전

그리고 전역변수로 next를 만드는게 안되는거지

구조체 멤버로는 사용 가능해요..

baekjoon   8년 전

읔ㅋㅋㅋㅋ 소스를 안보고 에러 메시지만 봤더니 이런 실수를 ㅠㅠ

댓글을 작성하려면 로그인해야 합니다.