When I compile my code, I get these errors:
------ Build started: Project: engine, Configuration: Debug Win32 ------
Compiling...
baseanimating.cpp
c:\program files\microsoft visual studio 9.0\vc\include\time.h(39) : error C2143: syntax error : missing ';' before 'string'
c:\program files\microsoft visual studio 9.0\vc\include\time.h(39) : error C2059: syntax error : 'string'
c:\program files\microsoft visual studio 9.0\vc\include\time.h(39) : error C2143: syntax error : missing ';' before '{'
c:\program files\microsoft visual studio 9.0\vc\include\time.h(39) : error C2447: '{' : missing function header (old-style formal list?)
c:\program files\microsoft visual studio 9.0\vc\include\ctime(19) : error C2039: 'clock_t' : is not a member of '`global namespace''
c:\program files\microsoft visual studio 9.0\vc\include\ctime(19) : error C2873: 'clock_t' : symbol cannot be used in a using-declaration
c:\program files\microsoft visual studio 9.0\vc\include\ctime(21) : error C2039: 'asctime' : is not a member of '`global namespace''
c:\program files\microsoft visual studio 9.0\vc\include\ctime(21) : error C2873: 'asctime' : symbol cannot be used in a using-declaration
c:\program files\microsoft visual studio 9.0\vc\include\ctime(21) : error C2039: 'clock' : is not a member of '`global namespace''
c:\program files\microsoft visual studio 9.0\vc\include\ctime(21) : error C2873: 'clock' : symbol cannot be used in a using-declaration
c:\program files\microsoft visual studio 9.0\vc\include\ctime(21) : error C2039: 'ctime' : is not a member of '`global namespace''
c:\program files\microsoft visual studio 9.0\vc\include\ctime(21) : error C2873: 'ctime' : symbol cannot be used in a using-declaration
c:\program files\microsoft visual studio 9.0\vc\include\ctime(22) : error C2039: 'difftime' : is not a member of '`global namespace''
c:\program files\microsoft visual studio 9.0\vc\include\ctime(22) : error C2873: 'difftime' : symbol cannot be used in a using-declaration
c:\program files\microsoft visual studio 9.0\vc\include\ctime(22) : error C2039: 'gmtime' : is not a member of '`global namespace''
c:\program files\microsoft visual studio 9.0\vc\include\ctime(22) : error C2873: 'gmtime' : symbol cannot be used in a using-declaration
c:\program files\microsoft visual studio 9.0\vc\include\ctime(22) : error C2039: 'localtime' : is not a member of '`global namespace''
c:\program files\microsoft visual studio 9.0\vc\include\ctime(22) : error C2873: 'localtime' : symbol cannot be used in a using-declaration
c:\program files\microsoft visual studio 9.0\vc\include\ctime(23) : error C2039: 'mktime' : is not a member of '`global namespace''
c:\program files\microsoft visual studio 9.0\vc\include\ctime(23) : error C2873: 'mktime' : symbol cannot be used in a using-declaration
c:\program files\microsoft visual studio 9.0\vc\include\ctime(23) : error C2039: 'strftime' : is not a member of '`global namespace''
c:\program files\microsoft visual studio 9.0\vc\include\ctime(23) : error C2873: 'strftime' : symbol cannot be used in a using-declaration
c:\program files\microsoft visual studio 9.0\vc\include\ctime(23) : error C2039: 'time' : is not a member of '`global namespace''
c:\program files\microsoft visual studio 9.0\vc\include\ctime(23) : error C2873: 'time' : symbol cannot be used in a using-declaration
c:\documents and settings\tom\my documents\visual studio 2008\projects\engine\engine\timer.h(7) : error C2146: syntax error : missing ';' before identifier 'counter'
c:\documents and settings\tom\my documents\visual studio 2008\projects\engine\engine\timer.h(7) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
c:\documents and settings\tom\my documents\visual studio 2008\projects\engine\engine\timer.h(7) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
c:\documents and settings\tom\my documents\visual studio 2008\projects\engine\engine\timer.h(11) : error C2061: syntax error : identifier 'clock_t'
c:\documents and settings\tom\my documents\visual studio 2008\projects\engine\engine\timer.h(9) : error C2614: 'CTimer' : illegal member initialization: 'counter' is not a base or member
c:\documents and settings\tom\my documents\visual studio 2008\projects\engine\engine\timer.h(13) : error C2065: 'clock_t' : undeclared identifier
c:\documents and settings\tom\my documents\visual studio 2008\projects\engine\engine\timer.h(13) : error C2146: syntax error : missing ';' before identifier 'tick'
c:\documents and settings\tom\my documents\visual studio 2008\projects\engine\engine\timer.h(13) : error C2065: 'tick' : undeclared identifier
c:\documents and settings\tom\my documents\visual studio 2008\projects\engine\engine\timer.h(13) : error C2039: 'clock' : is not a member of 'std'
c:\documents and settings\tom\my documents\visual studio 2008\projects\engine\engine\timer.h(13) : error C3861: 'clock': identifier not found
c:\documents and settings\tom\my documents\visual studio 2008\projects\engine\engine\timer.h(15) : error C2065: 'tick' : undeclared identifier
c:\documents and settings\tom\my documents\visual studio 2008\projects\engine\engine\timer.h(15) : error C2065: 'counter' : undeclared identifier
c:\documents and settings\tom\my documents\visual studio 2008\projects\engine\engine\timer.h(15) : error C2065: 'ms' : undeclared identifier
c:\documents and settings\tom\my documents\visual studio 2008\projects\engine\engine\timer.h(17) : error C2065: 'counter' : undeclared identifier
c:\documents and settings\tom\my documents\visual studio 2008\projects\engine\engine\timer.h(17) : error C2065: 'tick' : undeclared identifier
c:\documents and settings\tom\my documents\visual studio 2008\projects\engine\engine\baseanimating.cpp(28) : warning C4018: '<' : signed/unsigned mismatch
c:\documents and settings\tom\my documents\visual studio 2008\projects\engine\engine\baseanimating.cpp(39) : warning C4018: '<' : signed/unsigned mismatch
c:\documents and settings\tom\my documents\visual studio 2008\projects\engine\engine\baseanimating.cpp(50) : warning C4018: '<' : signed/unsigned mismatch
c:\documents and settings\tom\my documents\visual studio 2008\projects\engine\engine\baseanimating.cpp(61) : warning C4018: '<' : signed/unsigned mismatch
c:\documents and settings\tom\my documents\visual studio 2008\projects\engine\engine\baseanimating.cpp(72) : warning C4018: '<' : signed/unsigned mismatch
Build log was saved at "file://c:\Documents and Settings\tom\My Documents\Visual Studio 2008\Projects\engine\engine\Debug\BuildLog.htm"
engine - 39 error(s), 5 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
The only file that is mine out of those errors is time.h:
#ifndef TIMER_H
#define TIMER_H
#include <ctime>
class CTimer {
clock_t counter;
public:
CTimer(): counter(0) {}
bool elasped(clock_t ms)
{
clock_t tick = std::clock();
if(tick - counter >= ms)
{
counter = tick;
return true;
}
return false;
}
};
#endif //TIMER_H
Can someone help me to fix these errors?