template 사용시 선언할 때 에러가 계속 나서 질문드립니다.

2cminor의 이미지

Array <\Account *>\ accounts;

\는 빼구 봐주세요. 이 게시판에서 <안에 글이 잘 나오게 하는 법 아시는 분ㅠㅠ;

이걸 클래스 내에 속성으로 지정했구요.
에러 내용은

\cashbook.h(35) : error C2143: syntax error : missing ';' before '<'
\cashbook.h(35) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
cashbook.h(35) : error C2238: unexpected token(s) preceding ';'

참고로 컴파일러는 vs2008이구요
저 선언 부분만 주석 처리 하면 에러가 안뜨네요. 저 부분이 확실히 문제긴 한것 같은데.
C++ does not support default-int 이게 에러로 잘 뜨던데 디폴트 인트를 지원 안한다는 건 어떤 의미인지도 궁금하구요..ㅠㅠ

질문을 요 근래에 자주 올려서 민망하기도 하지만.. 답변 주시면 감사하겠습니다.

terzeron의 이미지

일단 Array라는 컨테이너 타입을 알지 못하니 < 기호 앞에서 문장의 terminator인 ; 기호가 나타나기를 바란다는 의미입니다. 아마 Array라는 컨테이너가 정의된 namespace를 지정하지 않아서 발생한 것으로 짐작됩니다. (cli?)

이렇게 문제가 생기다보니 어떤 값에 대해서 타입이 정의되지 않은 상황으로 간주해버린 게 그 다음 줄 에러입니다.
"어쩌구 \ count;"로 받아들이고 보니 타입이 없는데, "int를 생략한 거냐? c++은 int가 default로 있다고 가정하지 않는다"라고 말해주고 있는 거죠.

2cminor의 이미지

일단 에러는 프로젝트 새로 설정하고 다시 시작하니 잡아지네요 ㅡㅡ;휴...
근데 이상하게 어떤 프로젝트에서는 에러가 안났다가 또 저런 에러가 났다가 하네요.

그리고 다중선언 됐다고 에러날 때 /FORCE:MULTIPLE를 해주니깐 invalid numeric argument '/FORCE:MULTIPLE' 이런 에러가 났다가
또 고대로 새로 프로젝트를 만드니깐 되고..이러니깐 정확한 원인도 모르겠고 답답하네요 ㅠㅠ

klyx의 이미지

정확한 답을 얻고 싶으시면 제대로된 소스를 올려주세요.

2cminor의 이미지

주석처리 했을 땐 에러가 나지 않았기 때문에... 그렇게 판단되서 소스는 저것만 올린건예요.
담번에 올릴 때 참고하겠습니당.

댓글 달기

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
이것은 자동으로 스팸을 올리는 것을 막기 위해서 제공됩니다.