I am using time functions within my smart contracts and I'm seeing differences between eosiocpp and g++. The below compiles and executes with no problem using g++.
time_t rawtime;
tm * timeinfo;
time(&rawtime);
timeinfo = localtime (&rawtime);
printf ("Current local time and date: %s", asctime(timeinfo));
However, when using eosiocpp, I get the following compilation errors. My includes are the same.
eosride.cpp:150:9: error: redefinition of 'rawtime' with a different type: 'time (&)' (aka 'unsigned long &') vs 'time_t' (aka 'long')
time(&rawtime);
^
eosride.cpp:148:10: note: previous definition is here
time_t rawtime;
^
eosride.cpp:150:9: error: declaration of reference variable 'rawtime' requires an initializer
time(&rawtime);
^~~~~~~
eosride.cpp:152:14: error: use of undeclared identifier 'localtime'
timeinfo = localtime (&rawtime);
What are the differences between eosiocpp and g++? Why would some basic code compile with g++ but not with eosiocpp?