timespec problem
- 
					
					
					
					
 Hi! Dieser Code hier: #include "time.h" int main() { timespec a; return 0; }Gibt diese Fehlermeldung 
 *
 mb@lfs:~> gcc -o aaa aaa.c
 aaa.c: In functionmain': aaa.c:5:timespec' undeclared (first use in this function)
 aaa.c:5: (Each undeclared identifier is reported only once
 aaa.c:5: for each function it appears in.)
 aaa.c:5: parse error before "a"
 *Warum? Da stimmt doch bestimmt irgendwas mit dem namespace nicht. Wie kann ich das beheben? 
 Danke!
 MFG fsd.
 
- 
					
					
					
					
 timespec ist wohl eine Klasse, die in time.h definiert ist? Solltest du dich tatsächlich nicht im Forum geirrt haben, dann compilier doch dein C++-Programm auch mit einem C++-Compiler. [gcc-spezifisch] 
 1. Das Suffix .c steht für C. C++-Programme sollte eine der folgenden Suffixe haben: .cc .cpp .C .cxx .c++2. Der C++-Compiler wird, wenn du unter Unix arbeitest, mit g++ aufgerufen. Unter DOS (DJGPP) oder Windows müßte es gxx oder gpp sein. 
 [/gcc-spezifisch]
 
- 
					
					
					
					
 OH SORRY! 
 Ich hab mich im Forum vertan! Bitte um Verschiebung. :p danke. 
 MFG fsd.
 
- 
					
					
					
					
 Dann steht eben in deiner time.h kein timespec-typedef drin. Du mußt doch wissen was du in deine Dateien reinschreibst. 
 
- 
					
					
					
					
 oops. es sollte heißen #include <time.h>time.h ist eine Systemdatei.  MFG fsd. 
 
- 
					
					
					
					
 ... in welcher kein Typ namens timespec definiert wird. Was soll das ganze? 
 
- 
					
					
					
					
 natürlich ist der definiert! Aus der glibc Referenz: struct timespec 
 Data TypeThe struct timespec structure represents an elapsed time. It is declared in time.h and has the following members: 
 long int tv_sec
 This represents the number of whole seconds of elapsed time.
 long int tv_nsec
 This is the rest of the elapsed time (a fraction of a second), represented as the number of nanoseconds. It is always less than one billion.MFG fsd. 
 
- 
					
					
					
					
 Da steht 'struct timespec', nicht 'timespec'. 
 
- 
					
					
					
					
 DANKE! Naja, wenn man halt nicht lesen kann.  
 danke, es funktioniert jetzt.MFG fsd.