纠结问题很简单。

t_fast 2010-10-29 07:59:38
#include "iostream"
#define struct St;
#define person Per;

using namespace std;

struct dd{
int a;
}

问题:struct dd 有问题么?
为什么不能用啊。去掉了就能编译通过。。。
问题2:如何省略std::啊?using namespace std:
是什么意思??
超级菜鸟打扰了。
...全文
81 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
無_1024 2010-10-29
  • 打赏
  • 举报
回复
[Quote=引用 5 楼 schoolers 的回复:]
C/C++ code

#include "iostream" // 用<>
#define struct St; // 结构体的话应该用typedef struct St;
#define person Per; // define后不能加分号

using namespace std;

struct dd{
int a;
} // 少写了分号

……
[/Quote]
赞同 少了一个分号
using namespace std;是调用类库std的相关对象
gules 2010-10-29
  • 打赏
  • 举报
回复
[Quote=引用 3 楼 t_fast 的回复:]
预处理是为了简写啊。。。
[/Quote]

简写?要编译器承认啊!
就拿struct来说,编译器只认 struct ,它认 St 吗?
某某9 2010-10-29
  • 打赏
  • 举报
回复

#include "iostream" // 用<>
#define struct St; // 结构体的话应该用typedef struct St;
#define person Per; // define后不能加分号

using namespace std;

struct dd{
int a;
} // 少写了分号
t_fast 2010-10-29
  • 打赏
  • 举报
回复
vs2005。。。
t_fast 2010-10-29
  • 打赏
  • 举报
回复
预处理是为了简写啊。。。
gules 2010-10-29
  • 打赏
  • 举报
回复
struct是关键字啊!你把它给“预处理”还玩啥?
pengzhixi 2010-10-29
  • 打赏
  • 举报
回复
#define struct St;//这个是干什么

64,282

社区成员

发帖
与我相关
我的任务
社区描述
C++ 语言相关问题讨论,技术干货分享,前沿动态等
c++ 技术论坛(原bbs)
社区管理员
  • C++ 语言社区
  • encoderlee
  • paschen
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
  1. 请不要发布与C++技术无关的贴子
  2. 请不要发布与技术无关的招聘、广告的帖子
  3. 请尽可能的描述清楚你的问题,如果涉及到代码请尽可能的格式化一下

试试用AI创作助手写篇文章吧