鱼C论坛

 找回密码
 立即注册
查看: 2044|回复: 9

[已解决]网上看到的一段有趣的代码,怎么改才能让它能编译呢?

[复制链接]
发表于 2018-1-20 18:27:46 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能^_^

您需要 登录 才可以下载或查看,没有账号?立即注册

x
  1. #define 喵喵喵 main
  2. #define 喵喵 int
  3. #define 喵 (
  4. #define 喵喵呜 )
  5. #define 喵喵喵喵 {
  6. #define 喵呜喵 }
  7. #define 喵呜喵呜喵 printf
  8. #define 呜 "\n"
  9. #define 喵呜喵呜 return
  10. #define 呜喵 0
  11. #define 喵呜 ;
  12. #include <stdio.h>
  13. 喵喵 喵喵喵 喵 喵喵呜
  14. 喵喵喵喵
  15. 喵呜喵呜
  16. 喵 喵 "喵喵喵! " 呜 喵喵呜 喵呜
  17. 喵呜喵呜 呜喵 喵呜
  18. 喵呜喵

复制代码

这样编译提示error: macro names must be identifiers.
最佳答案
2018-1-20 19:45:18
VS, 你这个不识别估计是字符集的问题,有些没办法识别中文的宏名字,VS在这方面还是比较兼容的
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复

使用道具 举报

发表于 2018-1-20 18:57:15 | 显示全部楼层
  1. #include <stdio.h>

  2. #define 喵喵喵 main
  3. #define 喵喵 int
  4. #define 喵 (
  5. #define 喵喵呜 )
  6. #define 喵喵喵喵 {
  7. #define 喵呜喵 }
  8. #define 喵呜喵呜喵 printf
  9. #define 呜 "\n"
  10. #define 喵呜喵呜 return
  11. #define 呜喵 0
  12. #define 喵呜 ;

  13. 喵喵 喵喵喵 喵 喵喵呜
  14. 喵喵喵喵
  15. 喵呜喵呜喵
  16. 喵 "喵喵喵! " 呜 喵喵呜 喵呜       
  17. 喵呜喵呜 呜喵 喵呜
  18. 喵呜喵
复制代码

  1. 喵喵喵!
  2. 请按任意键继续. . .
复制代码

  1. #include <stdio.h>

  2. #define 喵喵喵 main
  3. #define 喵喵 int
  4. #define 喵 (
  5. #define 喵喵呜 )
  6. #define 喵喵喵喵 {
  7. #define 喵呜喵 }
  8. #define 喵呜喵呜喵 printf
  9. #define 呜 "\n"
  10. #define 喵呜喵呜 return
  11. #define 呜喵 0
  12. #define 喵呜 ;

  13. 喵喵 喵喵喵 喵 喵喵呜
  14. 喵喵喵喵
  15.         喵呜喵呜喵 喵 "喵喵喵! " 呜 喵喵呜 喵呜
  16.         喵呜喵呜 呜喵 喵呜
  17. 喵呜喵
复制代码
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2018-1-20 19:10:14 | 显示全部楼层
  1. #define 喵喵喵 main
  2. #define 喵喵 int
  3. #define 喵 (
  4. #define 喵喵呜 )
  5. #define 喵喵喵喵 {
  6. #define 喵呜喵 }
  7. #define 喵呜喵呜喵 printf
  8. #define 呜 "\n"
  9. #define 喵呜喵呜 return
  10. #define 呜喵 0
  11. #define 喵呜 ;
  12. #include <stdio.h>
  13. 喵喵 喵喵喵 喵 喵喵呜
  14. 喵喵喵喵
  15. 喵呜喵呜喵
  16. 喵  "喵喵喵! " 呜 喵喵呜 喵呜
  17. 喵呜喵呜 呜喵 喵呜
  18. 喵呜喵
复制代码

中间的   喵呜喵呜   应该改为   喵呜喵呜喵   printf
下面多了一个  喵   括号,改为就能通过了
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

 楼主| 发表于 2018-1-20 19:38:08 | 显示全部楼层

你们用的神马编译器呢?这样改code::bolcks还是报错
error: macro names must be identifiers
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

 楼主| 发表于 2018-1-20 19:41:54 | 显示全部楼层
orino 发表于 2018-1-20 19:10
中间的   喵呜喵呜   应该改为   喵呜喵呜喵   printf
下面多了一个  喵   括号,改为就能通过了

你们用的神马编译器呢?这样改code::bolcks还是报错
error: macro names must be identifiers
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2018-1-20 19:45:18 | 显示全部楼层    本楼为最佳答案   
VS, 你这个不识别估计是字符集的问题,有些没办法识别中文的宏名字,VS在这方面还是比较兼容的
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2018-1-20 19:49:09 | 显示全部楼层
  1. #include <iostream>
复制代码
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2018-1-20 20:59:13 | 显示全部楼层
御笔剑客 发表于 2018-1-20 19:38
你们用的神马编译器呢?这样改code::bolcks还是报错
error: macro names must be identifiers

vs2017
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2018-1-20 21:00:46 | 显示全部楼层
御笔剑客 发表于 2018-1-20 19:38
你们用的神马编译器呢?这样改code::bolcks还是报错
error: macro names must be identifiers

已经说得很清楚了
无标题.png
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

 楼主| 发表于 2018-1-20 23:09:48 | 显示全部楼层
orino 发表于 2018-1-20 19:45
VS, 你这个不识别估计是字符集的问题,有些没办法识别中文的宏名字,VS在这方面还是比较兼容的

对,是字符集的问题,我调成UTF-8以后就正常了
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Archiver|鱼C工作室 ( 粤ICP备18085999号-1 | 粤公网安备 44051102000585号)

GMT+8, 2024-5-18 10:02

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表