Windows 7上的Mimetex安装 [英] Mimetex installation on Windows 7
问题描述
我正在尝试在Windows 7上安装
但是仍然创建了exe.当我尝试启动该exe时,我看到了此错误:
可能与我的Windows版本不兼容吗?如果是,我该怎么解决?
谢谢.
mimetex使用的strcasestr不是C标准的,并非在每个平台上都可用.从>在C中的strcasestr如何进行示例代码工作.不断收到错误外部符号并放入一个strcasestr.c文件
$ cat strcasestr.c#include< stdlib.h>#include< ctype.h>char * strcasestr(const char * str,const char * pattern){size_t i;如果(!* pattern)返回(char *)str;对于(; * str; str ++){如果(toupper(* str)== toupper(* pattern)){对于(i = 1 ;; i ++){如果(!pattern [i])返回(char *)str;如果(toupper(str [i])!= toupper(pattern [i]))休息;}}}返回NULL;}
现在我们可以编译出很多警告:
$ x86_64-w64-mingw32-gcc -Wall -DWINDOWS -DAA mimetex.c gifsave.c strcasestr.c -lm -o mimetex.cgimimetex.c:在"rastsmash"函数中:mimetex.c:2384:26:警告:设置了变量"ymin"但未使用[-Wunused-but-set-variable]....mimetex.c:16687:2:警告:设置了变量"isqempty"但未使用[-Wunused-but-set-variable]isqempty = 0,/*如果查询字符串为空,则为true */^ ~~~~~~~~$ ls -l mimetex.cgi-rwxr-xr-x 1 Marco Kein 1.8M 1月1日08:31 mimetex.cgi
在CMD会话中对其进行测试,可以按照自述文件的建议验证它是否是独立的Windows程序:
> mimetex.cgi"x ^ 2 + y ^ 2"+ ----------------------------------------------------------------------- +| mimeTeX vers 1.75,John Forkosh Associates,Inc.版权所有(c)2002-2017 |+ ----------------------------------------------------------------------- +|mimeTeX是免费软件,已根据GNU/GPL的条款授权给您,|并且绝对没有任何担保.||有关详细信息,请参见http://www.forkosh.com/mimetex.html.|+ ----------------------------------------------------------------------- +最新修订:2017年6月10日位图的ascii转储.................... *** ...................................... *** ................... * ... * ............................................. * ... * ....................... ** ... ** ........................................... ** ... **..................... ** .... * ........................................... ** .... *..................... ** ........... * ...................... **..................... ** ........... * ...................... **....... * ..... * ........ * ...... ** .. **** ....... * ............. * ........... ** ..... * ....... * ...... * .. ** ... * ...... * ....................... * .......... *.* ..... * ...... * ...... * ... * .......... * ... * ........... * .......... *.* ..... * ..... * ... *... * ... * ......... * .... * ........... * .......... *.* ..... * .... * .... *...... * ......... ******** .... *************** .... * .....* .... *******...... * .................................... * ........... * .....* ................. * .... * ...................... * ........... * .....* ................. * .... * ...................... * ........... * ....** ............* ... ** ... * ....................... * ........... * ... ** ..............*** .. *** .................................... ** ............ **** ............................................... * ................* .............................................. * ............... *................................................................... * ... *.................................................................. *** ................
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.
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...
.................***......................................***...
................*...*....................................*...*..
...............**...**..................................**...**.
...............**....*..................................**....*.
....................**...........*...........................**.
....................**...........*...........................**.
....................*............*...........................*..
....**..****.......*.............*...........**.....*.......*...
...*..**...*......*..............*..........*.*.....*......*....
..*...*..........*...*...........*..........*.*.....*.....*...*.
..*...*.........*....*...........*..........*.*.....*....*....*.
.....*.........*******....***************....*.....*....*******.
.....*...........................*...........*.....*............
.....*....*......................*...........*.....*............
.....*....*......................*...........*....**............
*...**...*.......................*...........*...**.............
.***..***........................*............***.*.............
.................................*................*.............
.................................*...............*..............
............................................*...*...............
.............................................***................
这篇关于Windows 7上的Mimetex安装的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!