2010-02-08 11 views
5

मैं इस प्रकार सी में एक कॉलबैक दिनचर्या घोषित करने के लिए कोशिश कर रहा हूँ ++:"अपूर्ण प्रकार की अनुमति नहीं है" त्रुटि का क्या अर्थ है?

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

सिंटेक्स हाइलाइटिंग यहाँ एक उपयोगी संकेत ... – ephemient

+0

देता है तुम भी typedef यदि आप कोड करने के लिए इस आसान मिल सकता है फ़ंक्शन पॉइंटर: 'टाइपपीफ इंट (* एफएन) (कॉन्स चार *, कॉन्स char * newStr); शून्य रजिस्टर_रेनाम (एफएन); ' –

+1

इसके अलावा,' शून्य रजिस्टर_रेनाम (int (*) (कॉन्स 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 
संबंधित मुद्दे