2010-02-08 3 views
5

나는 C++로 콜백 루틴을 선언하는 것을 시도하고있다 :"불완전한 유형이 허용되지 않습니다"라는 오류는 무엇을 의미합니까? 다음과 같이

line 204: error #70: 
     incomplete type is not allowed 
void register_rename (int (*function) (const char *current, const char *new)); 

나는이 문제를 해결하는 방법을 잘 모르겠어요 :

void register_rename (int (*function) (const char *current, const char *new)); 
    /*------------------------------------------------------------*/ 
    /* WHEN: The callback is called once each time a file is received and 
    * accepted. (Renames the temporary file to its permanent name) 
    * WHAT: Renames a file from the given current name to the specified new name. 
    */ 

그러나, 나는 다음과 같은 오류가 발생합니다. 동일한 헤더 파일에 선언 된 다른 유사한 콜백 루틴이 있는데이 오류가 발생하지 않습니다.

도와주세요! :)

+11

구문 강조는 또한 typedef입니다 당신이 경우 코딩이 쉽게 찾을 수 있습니다 여기에 유용한 힌트 ... – ephemient

+0

을 제공합니다 함수 포인터 :'typedef int (* fn) (const char *, const char * newStr); void register_rename (fn); ' –

+1

또한 void register_rename (int (*) (const char *, const char *));는 동등한 프로토 타입입니다. 이름은 필요하지 않습니다. – ephemient

답변

19

키워드이기 때문에 새 기능을 사용할 수 없습니다. 두 번째 인수에 유효한 식별자를 선택하십시오.

7

예약어로 변수 또는 식별자를 지정할 수 없습니다.

예약어는 일부 사업자의

asm do if return try 
auto double inline short typedef 
bool dynamic_cast int signed typeid 
break else long sizeof typename 
case enum mutable static union 
catch explicit namespace static_assert unsigned 
char export **new** static_cast using 
class extern operator struct virtual 
const false private switch void 
const_cast float protected template volatile 
continue for public this wchar_t 
default friend register throw while 
delete goto reinterpret_cast true 

및 대체 이름 키워드입니다

and and_eq bitand bitor compl not 
not_eq or or_eq xor xor_eq 
관련 문제