#include <iostream>
#include <mongo/util/time_support.h>
using namespace std;
int main()
{
cout << mongo::curTimeMillis64() << endl;
return 0;
}
g++ -I/tmp/include prova.cpp -o prova -L/tmp/lib -lmongoclient
/tmp/ccH0vDvx.o: In function `main':
prova.cpp:(.text+0x5): undefined reference to `mongo::curTimeMillis64()'
collect2: error: ld returned 1 exit status
nm /tmp/lib/libmongoclient.so | grep curTime
00000000000ea510 t _ZN5mongo13curTimeMicrosEv
00000000000ea4f0 t _ZN5mongo15curTimeMicros64Ev
00000000000ea440 t _ZN5mongo15curTimeMillis64Ev
Hi,someone can help me with this issue?i have this sample code:
#include <iostream>
#include <mongo/util/time_support.h>
using namespace std;
int main()
{
cout << mongo::curTimeMillis64() << endl;
return 0;
}
and compile with:
g++ -I/tmp/include prova.cpp -o prova -L/tmp/lib -lmongoclient
the result is:
/tmp/ccH0vDvx.o: In function `main':
prova.cpp:(.text+0x5): undefined reference to `mongo::curTimeMillis64()'
collect2: error: ld returned 1 exit status
I use the 26compat of mongo cxx driver and i have also check with nm the symbols within the library:
nm /tmp/lib/libmongoclient.so | grep curTime
00000000000ea510 t _ZN5mongo13curTimeMicrosEv
00000000000ea4f0 t _ZN5mongo15curTimeMicros64Ev
00000000000ea440 t _ZN5mongo15curTimeMillis64Ev
everything seems to be ok but the compile fails. Any suggestions?
unsigned long long mongo::curTimeMillis64()
Date_t mongo::jsTime()
For solving my problem i have replaced:
unsigned long long mongo::curTimeMillis64()with:
Date_t mongo::jsTime()because in my case the time obtained from curTimeMillis64 would be used to build a Date_t struct.