If you’re having this issue with building
https://gitlab.com/mattwb65/srt-live-server.git
1 2 3 4 5 6 7 8 9 10 11 |
slscore/common.cpp: In function ‘void sls_gettime_fmt(char*, int64_t, char*)’: slscore/common.cpp:111:5: error: ‘time’ was not declared in this scope 111 | time (&rawtime); | ^~~~ slscore/common.cpp:113:16: error: ‘localtime’ was not declared in this scope 113 | timeinfo = localtime (&rawtime); | ^~~~~~~~~ slscore/common.cpp:114:5: error: ‘strftime’ was not declared in this scope 114 | strftime(timef, sizeof(timef), fmt, timeinfo); | ^~~~~~~~ make: *** [Makefile:63: obj/common.o] Error 1 |
add an include of “time.h” in slscore/common.cpp, so it looks like this
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
#include <sys/socket.h> #include <sys/stat.h> #include <sys/time.h> #include <sys/types.h> #include <netinet/in.h> #include <arpa/inet.h> #include <cstdarg> #include <errno.h> #include <fcntl.h> #include <netdb.h> #include <signal.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> #include <string> #include <vector> #include "time.h" #include "common.hpp" |