c++ - why can't I use clock_t in codeblocks 12.11 compiler? -
i trying compile code in codeblocks showing error.
code was:
#include<iostream> #include<cstdio> #include<cstdlib> #include<ctime> #include<iostream> using namespace std; void f() { int sum=0; for(int i=0;i<100000000;i++) sum++; } int main() { clock_t start,end; start=clock(); f(); end=clock(); cout<<((double)end-start)/clocks_per_sec<<endl; }
but showing error, error that:
" #error file requires compiler , library support iso c++ 2011 standard. support experimental, , must enabled -std=c++11 or -std=gnu++11 compiler options."
now?
as suggested error, enable c++11 feature. (thanks @chris' comment) :
it's right in settings. there's literally option says "use c++11 standard".
Comments
Post a Comment