Mimetex installation on Windows 7

僤鯓⒐⒋嵵緔 提交于 2020-01-07 08:02:20

问题


I'm trying to install mimetex on Windows 7. To achieve this, I installed first cygwin on my machine, and then in the prompt window I typed:

gcc -DAA -DWINDOWS mimetex.c gifsave.c -lm -o mimetex.exe

in the right directory. In the prompt I read:

but the exe was anyway created. When I tried to launch that exe, I saw this error:

Could it be some incompatibility with my Windows version? If yes, how can I solve?

Thanks in advance.


回答1:


mimetex is using strcasestr that is not C standard and not available in every platform. Taking the example code from How does strcasestr in C work. Keep getting Error external symbol and putting in a strcasestr.c file we have

$ cat strcasestr.c
#include <stdlib.h>
#include <ctype.h>

char *strcasestr(const char *str, const char *pattern) {
    size_t i;

    if (!*pattern)
        return (char*)str;

    for (; *str; str++) {
        if (toupper(*str) == toupper(*pattern)) {
            for (i = 1;; i++) {
                if (!pattern[i])
                    return (char*)str;
                if (toupper(str[i]) != toupper(pattern[i]))
                    break;
            }
        }
    }
    return NULL;
}

and we can now compile with a lot of warning:

$ x86_64-w64-mingw32-gcc -Wall  -DWINDOWS -DAA mimetex.c gifsave.c strcasestr.c -lm -o mimetex.cgi
mimetex.c: In function ‘rastsmash’:
mimetex.c:2384:26: warning: variable ‘ymin’ set but not used [-Wunused-but-set-variable]
....
mimetex.c:16687:2: warning: variable ‘isqempty’ set but not used [-Wunused-but-set-variable]
  isqempty = 0,   /* true if query string empty */
  ^~~~~~~~
$ ls -l mimetex.cgi
-rwxr-xr-x 1 Marco Kein 1.8M Jan  1 08:31 mimetex.cgi

Testing it in a CMD session, you can verify as suggested by the README that it is a stand alone windows program:

>mimetex.cgi "x^2+y^2"
+-----------------------------------------------------------------------+
|mimeTeX vers 1.75, Copyright(c) 2002-2017, John Forkosh Associates, Inc|
+-----------------------------------------------------------------------+
| mimeTeX is free software, licensed to you under terms of the GNU/GPL, |
|           and comes with absolutely no warranty whatsoever.           |
|          See http://www.forkosh.com/mimetex.html for details.         |
+-----------------------------------------------------------------------+
Most recent revision: 10 June 2017

Ascii dump of bitmap image...
.................***......................................***...
................*...*....................................*...*..
...............**...**..................................**...**.
...............**....*..................................**....*.
....................**...........*...........................**.
....................**...........*...........................**.
....................*............*...........................*..
....**..****.......*.............*...........**.....*.......*...
...*..**...*......*..............*..........*.*.....*......*....
..*...*..........*...*...........*..........*.*.....*.....*...*.
..*...*.........*....*...........*..........*.*.....*....*....*.
.....*.........*******....***************....*.....*....*******.
.....*...........................*...........*.....*............
.....*....*......................*...........*.....*............
.....*....*......................*...........*....**............
*...**...*.......................*...........*...**.............
.***..***........................*............***.*.............
.................................*................*.............
.................................*...............*..............
............................................*...*...............
.............................................***................


来源:https://stackoverflow.com/questions/59519761/mimetex-installation-on-windows-7

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!