Win32 App - Undefined struct 'timespec' when using VS 2013
Posted: Wed Nov 16, 2016 4:39 pm
When using Visual Studio 2013, if you reference only the headers mentioned in the docs (wimlib.h, wimlib_tchar.h) and build an otherwise empty project, you receive the following errors:
Error 1 error C2079: 'wimlib_dir_entry::creation_time' uses undefined struct 'timespec' wimlib.h
Error 2 error C2079: 'wimlib_dir_entry::last_write_time' uses undefined struct 'timespec' wimlib.h
Error 3 error C2079: 'wimlib_dir_entry::last_access_time' uses undefined struct 'timespec' wimlib.h
Warning warning C4200: nonstandard extension used : zero-sized array in struct/union wimlib.h
Here are repro steps:
1. File > New Project > Visual C++ > Win32 > Win32 Console Application
2. Leave defaults for Win32 Application Wizard
3. Copy wimlib.h and wimlib_tchar.h from wimlib-1.10.0\source\include to your project folder.
4. Project > Add Existing Item... > Select both wimlib.h and wimlib_tchar.h
5. Add #include "wimlib.h" to the top of your project's main CPP file (e.g. ConsoleApplication#.cpp)
6. Build > Build Solution
Same is true for the source examples such as capturewim.c. Normally I would attempt to resolve and post findings, however this appears to deal with POSIX and time resolution, both subjects of which I'm no expert.
Error 1 error C2079: 'wimlib_dir_entry::creation_time' uses undefined struct 'timespec' wimlib.h
Error 2 error C2079: 'wimlib_dir_entry::last_write_time' uses undefined struct 'timespec' wimlib.h
Error 3 error C2079: 'wimlib_dir_entry::last_access_time' uses undefined struct 'timespec' wimlib.h
Warning warning C4200: nonstandard extension used : zero-sized array in struct/union wimlib.h
Here are repro steps:
1. File > New Project > Visual C++ > Win32 > Win32 Console Application
2. Leave defaults for Win32 Application Wizard
3. Copy wimlib.h and wimlib_tchar.h from wimlib-1.10.0\source\include to your project folder.
4. Project > Add Existing Item... > Select both wimlib.h and wimlib_tchar.h
5. Add #include "wimlib.h" to the top of your project's main CPP file (e.g. ConsoleApplication#.cpp)
6. Build > Build Solution
Same is true for the source examples such as capturewim.c. Normally I would attempt to resolve and post findings, however this appears to deal with POSIX and time resolution, both subjects of which I'm no expert.