Turbo-C
C++Builder  |  Delphi  |  FireMonkey  |  C/C++  |  Free Pascal  |  Firebird
볼랜드포럼 BorlandForum
 경고! 게시물 작성자의 사전 허락없는 메일주소 추출행위 절대 금지
터보-C 포럼
Q & A
FAQ
팁&트릭
강좌/문서
자료실
Lua 게시판
볼랜드포럼 홈
헤드라인 뉴스
IT 뉴스
공지사항
자유게시판
해피 브레이크
공동 프로젝트
구인/구직
회원 장터
건의사항
운영진 게시판
회원 메뉴
북마크
볼랜드포럼 광고 모집

C/C++ Q/A
[6116] Re:헤더파일 에러가 나는데 어째야 할지 모르겠습니다 도와주세요
최준호.스페로 [sparrow] 4020 읽음    2007-12-11 09:16
일단 컴파일러가 C++이 아니라면 모르겠지만 new라는 키워드를 변수로 이용한것이 문제입니다.
new를 모두 n으로 변경 하시고요

cellCDT 구조체 선언에 마지막 } 다음에 ;요게 빠졌습니다.

그리고 main이 없으니 링크에러가 나겠죠.

메인 함수가 없는 부분일거라 생각 되니까.

일단 new를 변수처럼 이용한게 문제 입니다.
C만 지원하는 컴파일러에서는 에러가 없을지 모르겠네요..

남지민 님이 쓰신 글 :
: //cell.h
: typedef struct cellCDT *cell;
: cell new_cell(void);  /* create new cell*/
: void create_child( cell x, int y);  /*creates a child in given cells children area with value*/
: void free_cell( cell x ); /* frees cell */
: float get_val(cell x);   /*return strng held in cell*/
: void c_val(cell x, float y);   /* change value of cell*/
: cell lreturn(cell x);
: cell rreturn(cell x);
:
: ---------------------------------------------------------------------------------------
:
:
: #include <stdio.h>
: #include <stdlib.h>
: #include <string.h>
: #include "cell.h"
:
: struct cellCDT{
:   struct cellCDT* left;   //struct of each cell uniform across all
:   struct cellCDT* right;        //due to laziness
:   float value;
: }
:
:
:
: /*//////////////////////////////////////////////////////////
: // creates and initializes new cell with no input
: //
: //////////////////////////////////////////////////////////*/
: void new_cell()
: {
:   cell new = (cell)malloc( sizeof(*new) );
:   new->left=NULL;
:   new->right=NULL;
:   new->value=0;
:   return new;
: }

:
: /*********************************************************
: ** create child under a cell and add pointer to that cell's newly expanded
: **array
: ******************************************************************************/
: void create_child( cell x, int y)
: {
:   cell child_cell = new_cell();
:   if(y==0)
:     {
:       x->left = child_cell;
:       //innate bias to do nothing
:     }
:   else x->right = child_cell;
: }
:
:
: /***************frees all parts of cell and then frees self*******************/
: void free_cell( cell x )
: { 
:    if(x->left != NULL) free_cell(x->left);
:    if(x->right != NULL) free_cell(x->right);
:    free(x);
: }
:
:
: /***************return strng held in cell*************************************/
: float get_val(cell x)
: {
:   return x->value;
: }
:
: /**************change value of cell******************************************/
: void c_val(cell x, float y)
: {
:   x->value = x->value + y;
: }
:
: cell lreturn(cell x)
: {
:   return x->left;
: }
:
: cell rreturn(cell x)
: {
:   return x->right;
: }

+ -

관련 글 리스트
6115 헤더파일 에러가 나는데 어째야 할지 모르겠습니다 도와주세요 남지민 2453 2007/12/10
6116     Re:헤더파일 에러가 나는데 어째야 할지 모르겠습니다 도와주세요 최준호.스페로 4020 2007/12/11
6118         Re:Re:헤더파일 에러가 나는데 어째야 할지 모르겠습니다 도와주세요 남지민 2700 2007/12/12
Google
Copyright © 1999-2015, borlandforum.com. All right reserved.