c - 是否有解决此错误的方法:预期标识符或数字常量前的“(”?
问题描述
我从这里下载 zip 源代码:http: //gnuwin32.sourceforge.net/packages/zip.htm
我在 windows10 上用 Mingw-w64 编译它。
我使用以下命令编译此源:
# 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 CR 13
并将定义行移动到文件中的其他位置。
但是编译器也给了我同样的错误:(我将定义从第 265 行移到第 79 行)
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
我认为定义的代码是正确的,但我不知道为什么会出现错误,以及如何修复它。
解决方案
推荐阅读
- angular6 - EventEmitter 未更新 Angular 6 中父组件中的数组
- arrays - 将 dat 文件加载为数组数组
- r - 为 R 中的每个变量生成和存储频率表
- php - 从显示的表中发送特定数据(PHP)
- ruby - 如何在 vim 命令模式下对 Ruby 等语言使用“%”键击
- angular - 使用 Angular IDE 在我的单页应用程序上设置路由
- google-app-engine - 通过节点上传的谷歌云存储,图像已损坏
- ios - 点击 UITableView 单元格时如何显示 UIDatePicker?
- android - Google Play 服务实时多人房间创建不起作用
- java - 如何使用java将图像上传到cloudinary中具有唯一public_id的特定文件夹?