为什么我不能用// - 在我的C code风格的注释? [英] Why can't I use //-style comments in my C code?

查看:87
本文介绍了为什么我不能用// - 在我的C code风格的注释?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用 GCC (Ubuntu的4.4.1-4ubuntu9)来编译我正在写一个程序,但它似乎呕吐,只要自己认为//注释在我的code,说:

I am using gcc (Ubuntu 4.4.1-4ubuntu9) to compile a program that I'm writing, but it seems to vomit whenever it sees a // comment in my code, saying:

interface.c :##: error: expected expression before â/â token<

请问 GCC 编译模式我使用禁止 // 的意见?

Does the gcc compile mode I'm using forbid // comments?

$ gcc -g -ansi -pedantic interface.c structs.h -c -I. -I/home/me/project/h

为什么?

推荐答案

// 的意见是不允许在旧的(pre 99)C版本,使用 / ** / (或删除 -ansi ,这是对C89标准的代名词)

// comments are not allowed in old (pre 99) C versions, use /**/ (or remove the -ansi, that is a synonym for the C89 standard)

这篇关于为什么我不能用// - 在我的C code风格的注释?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆