Skip to content

Commit d0160f0

Browse files
ringlejfhunleth
authored andcommitted
When DEBUG is defined, fix multiple definiiton of log_location
Fixes several errors like this one when DEBUG is defined: circuits_uart/obj/util.o:(.bss+0x0): multiple definition of `log_location'; circuits_uart/obj/uart_comm_unix.o:(.bss+0x0): first defined here
1 parent 5cf365b commit d0160f0

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

src/util.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,10 @@
2222
#include <stdint.h>
2323

2424
//#define DEBUG
25-
2625
#ifdef DEBUG
27-
FILE *log_location;
26+
extern FILE *log_location;
2827
#define LOG_LOCATION log_location
29-
#define debug(...) do { fprintf(log_location, "%llu: ", current_time()); fprintf(log_location, __VA_ARGS__); fprintf(log_location, "\r\n"); fflush(log_location); } while(0)
28+
#define debug(...) do { fprintf(LOG_LOCATION, "%llu: ", current_time()); fprintf(LOG_LOCATION, __VA_ARGS__); fprintf(LOG_LOCATION, "\r\n"); fflush(LOG_LOCATION); } while(0)
3029
#else
3130
#define LOG_LOCATION stderr
3231
#define debug(...)

0 commit comments

Comments
 (0)