Skip to content

Ambiguous convert in app.c and db-table.c

When compiling on Ubuntu 20.04, the following errors will show

app.c: In destructor ‘App::~App()’:
app.c:310:33: error: conversion from ‘time_t’ {aka ‘long int’} to ‘Json::Value’ is ambiguous
  310 |         root["time"]["start"] = _start;
      |                                 ^~~~~~

Simple workaround method:

sed -i 's/root\["time"\]\["start"\] = _start;/root["time"]["start"] = static_cast<Json::Int64>(_start);/' app.c
sed -i 's/root\["time"\]\["end"\] = time( NULL );/root["time"]["end"] = static_cast<Json::Int64>(time(NULL));/' app.c
sed -i 's/root\["time"\]\["start"\] = _start;/root["time"]["start"] = static_cast<Json::Int64>(_start);/' db-table.c