0

I tried making this simple static library in Code::Blocks with MinGW:

#include <time.h>
#include <sys/time.h>
#include "header.h"

extern int go(int x)
{
  struct timeval t;
  gettimeofday(&t, NULL);
  return 1;
}

This same snippet works if compiled as a console app (with printf), but when compiled as a static library, the calling code keeps getting this error:

unresolved external symbol "_gettimeofday"
  • `gettimeofday` is not a standard C function, it might not be available. I don't have enough experience with MinGW to answer this question completely though. – fuz Oct 21 '15 at 12:31
  • Hi. So you mean that this would only occur with non-standard libraries? How could we ensure that such libraries are linked then? – JohnLee Oct 21 '15 at 12:35
  • Usually you would supply the flag `-l` to the compiler but I'm not sure how this works on Windows. – fuz Oct 21 '15 at 12:52

0 Answers0