Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/c/61.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C 是否有此错误的解决方案:预期标识符或';(';在数字常量之前?_C - Fatal编程技术网

C 是否有此错误的解决方案:预期标识符或';(';在数字常量之前?

C 是否有此错误的解决方案:预期标识符或';(';在数字常量之前?,c,C,我从这里下载zip源代码: 我用Mingw-w64在windows10上编译它 我使用以下命令编译此源代码: # mingw32-make -f win32/makefile.gcc zip.exe gcc -c -O3 -Wall -mms-bitfields -fno-exceptions -fomit-frame-pointer -DWIN32 -DZIP64_SUPPORT -DFORCE_WIN32_OVER_UNIX -DLARGE_FILE_SUPPORT -DUNICODE

我从这里下载zip源代码:

我用Mingw-w64在windows10上编译它

我使用以下命令编译此源代码:

# mingw32-make -f win32/makefile.gcc zip.exe
gcc -c   -O3 -Wall -mms-bitfields  -fno-exceptions -fomit-frame-pointer -DWIN32 -DZIP64_SUPPORT -DFORCE_WIN32_OVER_UNIX -DLARGE_FILE_SUPPORT -DUNICODE_SUPPORT -DUSE_EF_UT_TIME -DNTSD_EAS -DNO_STREAMING_STORE -ID:/Progra~1/GnuWin32/include -I. -ozip.o zip.c
我得到以下错误:

In file included from zip.c:16:
zip.h:265:16: error: expected identifier or '(' before numeric constant
 #define CR     13        /* '\r' on ASCII machines; must be 13 due to EBCDIC */
                ^~
mingw32-make: *** [win32/makefile.gcc:113: zip.o] Error 1

我试图对定义CR的这一行进行注释,它是有效的,但编译器给我的另一个关于CR的错误是未声明的

zipup.c:1220:53: error: 'CR' undeclared (first use in this function)
             if ((*buf++ = *b++) == '\n') *(buf-1) = CR, *buf++ = LF, len++;
我试图通过修改代码来修复它,但我不知道错误的原因,也不知道如何修复它

我已经这样替换了define:
#define CR 13

并将定义行移动到文件中的其他位置

但是编译器也给了我同样的错误: (我将定义从第265行移动到第79行)


我认为define的代码是正确的,但我不知道为什么会出现错误,以及如何修复它。

我不知道这个问题,将define更改为
#define CR_EX 13
,并更改此define的源代码,就可以了。完整的错误消息是什么?您只显示了最后一部分。我不知道是问题,将define更改为
#define CR_EX 13
,并更改此define的源代码,就可以了。完整的错误消息是什么?您只显示最后一部分。
In file included from zip.c:16:
zip.h:79:16: error: expected identifier or '(' before numeric constant
 #define CR     13
                ^~
mingw32-make: *** [win32/makefile.gcc:113: zip.o] Error 1