vendredi 27 février 2015

error: ‘time’ cannot be used as a function


I am trying to write a small function that will eventually store the current date and time in a text file. I am in Linux using g++ and keep getting a strange error.


Function(so far):



#include <ctime>
#include <time.h>
void write_updateTime(double time){
char buffer[80]={};
time_t rawt;
string local;
struct tm * timeinfo;
time(&rawt);
timeinfo = localtime(&rawt);

sprintf(buffer, "%s", asctime(timeinfo));
}


Error:


ApplicationModule.cpp:79:12: error: ‘time’ cannot be used as a function time(&rawt);


I have searched all over, and all the examples I have found use the time function this way. I have as well as


Any thoughts?




Aucun commentaire:

Enregistrer un commentaire