-
Notifications
You must be signed in to change notification settings - Fork 265
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
undefined reference to `_ftelli64' - MINGW - #193
Comments
I use MINGW-64 for windows with GNU GCC - when I compile for C program, it give me the undefined ref above. I tried to lookup many time on google but I found nothing !!! Except a hook in But |
Hello : https://fr.osdn.net/projects/mingw/ticket/38225 Legacy WINDOWS does not implement _ftelli64 till msvcr80... Just replaced _ftelli64 and _fseeki64 by ftell and fseek in miniz.h !! Works exactly the same !! THANKS ! This lib is great for microdevices !!!! |
Thanks, maybe I'll try to unify some configs, in the future. |
This issue has been encountered in two places: |
I've just sent PR: https://github.com/kuba--/zip/pull/207 (replacing _ftelli64 and _fseeko64 by ftell and fseek on for MINGW32). |
unless I'm misunderstanding something, that PR may not be right currently... as it tries to change something else ( In my particular case here's what I've changed (commented out and replaced): //#define MZ_FTELL64 _ftelli64
//#define MZ_FSEEK64 _fseeki64
#define MZ_FTELL64 ftell
#define MZ_FSEEK64 fseek and in context they are: ...
static FILE *mz_freopen(const char *pPath, const char *pMode, FILE *pStream) {
wchar_t *wPath = str2wstr(pPath);
wchar_t *wMode = str2wstr(pMode);
FILE *pFile = _wfreopen(wPath, wMode, pStream);
free(wPath);
free(wMode);
return pFile;
}
#ifndef MINIZ_NO_TIME
#include <sys/utime.h>
#endif
#define MZ_FILE FILE
#define MZ_FOPEN mz_fopen
#define MZ_FCLOSE fclose
#define MZ_FREAD fread
#define MZ_FWRITE fwrite
//#define MZ_FTELL64 _ftelli64
//#define MZ_FSEEK64 _fseeki64
#define MZ_FTELL64 ftell
#define MZ_FSEEK64 fseek
#define MZ_FILE_STAT_STRUCT _stat
#define MZ_FILE_STAT _stat
#define MZ_FFLUSH fflush
#define MZ_FREOPEN mz_freopen
#define MZ_DELETE_FILE remove
#elif defined(__MINGW32__)
#ifndef MINIZ_NO_TIME
#include <sys/utime.h>
#endif
#define MZ_FILE FILE
#define MZ_FOPEN(f, m) mz_fopen
#define MZ_FCLOSE fclose
#define MZ_FREAD fread
#define MZ_FWRITE fwrite
#define MZ_FTELL64 ftell
#define MZ_FSEEK64 fseek
#define MZ_FILE_STAT_STRUCT _stat
#define MZ_FILE_STAT _stat
#define MZ_FFLUSH fflush
#define MZ_FREOPEN(f, m, s) mz_freopen
#define MZ_DELETE_FILE remove
#elif defined(__TINYC__)
#ifndef MINIZ_NO_TIME
#include <sys/utime.h>
#endif
#define MZ_FILE FILE
#define MZ_FOPEN(f, m) fopen(f, m)
#define MZ_FCLOSE fclose
#define MZ_FREAD fread
#define MZ_FWRITE fwrite
#define MZ_FTELL64 ftell
#define MZ_FSEEK64 fseek
#define MZ_FILE_STAT_STRUCT stat
#define MZ_FILE_STAT stat
#define MZ_FFLUSH fflush
#define MZ_FREOPEN(f, m, s) freopen(f, m, s)
#define MZ_DELETE_FILE remove
#elif defined(__GNUC__) && _LARGEFILE64_SOURCE
#ifndef MINIZ_NO_TIME
#include <utime.h>
#endif
#define MZ_FILE FILE
#define MZ_FOPEN(f, m) fopen64(f, m)
#define MZ_FCLOSE fclose
#define MZ_FREAD fread
#define MZ_FWRITE fwrite
#define MZ_FTELL64 ftello64
#define MZ_FSEEK64 fseeko64
#define MZ_FILE_STAT_STRUCT stat64
#define MZ_FILE_STAT stat64
#define MZ_FFLUSH fflush
#define MZ_FREOPEN(p, m, s) freopen64(p, m, s)
#define MZ_DELETE_FILE remove
#else
#ifndef MINIZ_NO_TIME
#include <utime.h>
#endif
#define MZ_FILE FILE
#define MZ_FOPEN(f, m) fopen(f, m)
#define MZ_FCLOSE fclose
#define MZ_FREAD fread
#define MZ_FWRITE fwrite
#if _FILE_OFFSET_BITS == 64 || _POSIX_C_SOURCE >= 200112L
#define MZ_FTELL64 ftello
#define MZ_FSEEK64 fseeko
#else
#define MZ_FTELL64 ftell
#define MZ_FSEEK64 fseek
#endif
#define MZ_FILE_STAT_STRUCT stat
#define MZ_FILE_STAT stat
#define MZ_FFLUSH fflush
#define MZ_FREOPEN(f, m, s) freopen(f, m, s)
#define MZ_DELETE_FILE remove
#endif // #ifdef _MSC_VER
#endif // #ifdef MINIZ_NO_STDIO
... |
hmm looks like I've already had a version of so then, perhaps in addition to that PR, I've had to do the aforementioned 2-line change too. EDIT2: ok, if I use these 3 files from the PR https://github.com/kuba--/zip/tree/4e0e277b97d098f2df5da865855a39af6e2b9f7a/src
but if I apply the change I've mentioned in prev. comment, then it works, i get another error somewhere else further, but it passes the 'zip' issue:
so this is the change on top of your PR: diff --git a/E:/Downloads/miniz.h b/vendor/kuba-zip/miniz.h
index 7148d33..96536a2 100644
--- a/E:/Downloads/miniz.h
+++ b/vendor/kuba-zip/miniz.h
@@ -4874,8 +4874,12 @@ static int mz_mkdir(const char *pDirname) {
#define MZ_FCLOSE fclose
#define MZ_FREAD fread
#define MZ_FWRITE fwrite
-#define MZ_FTELL64 _ftelli64
-#define MZ_FSEEK64 _fseeki64
+
+//#define MZ_FTELL64 _ftelli64
+//#define MZ_FSEEK64 _fseeki64
+#define MZ_FTELL64 ftell
+#define MZ_FSEEK64 fseek
+
#define MZ_FILE_STAT_STRUCT _stat64
#define MZ_FILE_STAT mz_stat
#define MZ_FFLUSH fflush EDIT3: I've just realized that in my particular case, the change from the PR (for |
Hello,
I compile under Windows 7 64 bits and i got this undefined reference !
I already added -lws2_32 in linker options !
Please help me !!
The text was updated successfully, but these errors were encountered: