द्वारा लोड नहीं किए गए कॉन्स्टेंट्स मैंने पॉज़िक्स टाइमर का अध्ययन करना शुरू किया, इसलिए मैंने कुछ अभ्यास भी करना शुरू किया, लेकिन मुझे तुरंत कंपाइलर के साथ कुछ समस्याएं थीं। इस कोड को संकलित करते समय, मुझे CLOCK_MONOTONIC जैसे मैक्रोज़ के बारे में कुछ अजीब संदेश मिलते हैं। उनको विभिन्न पुस्तकालयों में परिभाषित किया गया है जैसे कि समय.h आदि। लेकिन कंपाइलर मुझे त्रुटियों देता है जैसे कि उन्हें परिभाषित नहीं किया गया है।कंपाइलर
यह क्योंकि मैं एक फेडोरा 16 उपयोग कर रहा हूँ अजीब है, और अपने दोस्तों के साथ Ubuntu के कुछ मैं कम से कम संकलक त्रुटियों मिलती है: -O
मैं gcc -O0 -g3 -Wall -c -fmessage-length=0 -std=c99 -lrt
यहाँ त्रुटियों मैं के साथ संकलन कर रहा हूँ:
struct sigevent sigeventStruct
देता है:storage size of ‘sigeventStruct’ isn’t known unused variable ‘sigeventStruct’ [-Wunused-variable] Type 'sigevent' could not be resolved unknown type name ‘sigevent’
sigeventStruct.sigev_notify = SIGEV_SIGNAL
देता है:‘SIGEV_SIGNAL’ undeclared (first use in this function) request for member ‘sigev_notify’ in something not a structure or union Field 'sigev_notify' could not be resolved
if(timer_create(CLOCK_MONOTONIC, sigeventStruct, numero1) == -1)
देता है:
:#include <stdio.h> #include <fcntl.h> #include <time.h> #include <stdlib.h> #include <errno.h> #include <unistd.h> #include <signal.h> int main() { timer_t numero1; struct sigevent sigeventStruct; sigeventStruct.sigev_notify = SIGEV_SIGNAL; if(timer_create(CLOCK_MONOTONIC, sigeventStruct, numero1) == -1) { printf("Errore: %s\n", strerror(errno)); } return 0; }
implicit declaration of function ‘timer_create’ [-Wimplicit-function- declaration] ‘CLOCK_MONOTONIC’ undeclared (first use in this function) Symbol 'CLOCK_MONOTONIC' could not be resolved
यहाँ कोड है
पर एक वर्कअराउंड के साथ एक सीडीटी-इंडेक्सर बग प्वाइंट फॉर्म में त्रुटियों के बजाय बस एक सुझाव है, बस उन्हें ठीक उसी तरह कॉपी करें क्योंकि वे प्रश्न में '
' ब्लॉक के अंदर हैं। –ठीक है अगली बार मैं आपके सुझाव –