Coder Social home page Coder Social logo

Comments (7)

mayah avatar mayah commented on August 22, 2024

Windows platform? Maybe Windows does not have timegm.
According to http://stackoverflow.com/questions/16647819/timegm-cross-platform, _mkgmtime will work.

Try
#define timegm _mkgmtime

from tinytoml.

 avatar commented on August 22, 2024

Works fine with the define directive, thanks!

from tinytoml.

 avatar commented on August 22, 2024

Sorry that I reopen but that gives me an new error, I don't know if this is based on the compiler (cause of linking) or on the header. I wrote simply this, to check if my files are valid:

/* at least lets check if the TOML based files are all valid */
            std::ifstream r_ifs(_r_file.toStdString().c_str());
            toml::Parser r_parser(r_ifs);
            toml::Value r_val = r_parser.parse();
            if (r_val.valid())
            {
                /* everything is fine */
                printf("root file is valid TOML\n");
            }

This gives me

debug/project.o: In function `ZN4toml6Parser9parseTimeERKSsPNS_5ValueE':
c:\arden/src/core/../../externals/tinytoml/toml.h:830: undefined reference to `_mkgmtime'

from tinytoml.

mayah avatar mayah commented on August 22, 2024

Since it's a link error, the code itself should be ok.

You're using mingw 32bit version? I found this one.
http://sourceforge.net/p/mingw-w64/bugs/473/
If this is true, It's mingw bug, I believe. You can follow this article to fix.

Or, try another approach.
Try to add timegm which is also mentioned in
http://stackoverflow.com/questions/16647819/timegm-cross-platform
by yourself? I didn't check it, but the writer says it works on Windows. I'm not sure it also works on mingw environment.

time_t timegm(struct tm * a_tm)
{
time_t ltime = mktime(a_tm);
struct tm tm_val;
gmtime_s(&tm_val, &ltime);
int offset = (tm_val.tm_hour - a_tm->tm_hour);
if (offset > 12)
{
offset = 24 - offset;
}
time_t utc = mktime(a_tm) - offset * 3600;
return utc;
}

from tinytoml.

 avatar commented on August 22, 2024

Yep using MinGW 32-bit but the version which was installed when installing Qt, so rebuilding would not work.

from tinytoml.

mayah avatar mayah commented on August 22, 2024

Then, try to define timegm() by yourself. Doesn't it work?

from tinytoml.

mayah avatar mayah commented on August 22, 2024

No update, closing.

from tinytoml.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.