首页 文章

mingw c编译

提问于
浏览
0

我正在尝试编译一个非常简单的C程序 . 使用自动安装程序安装MinGW,然后在我的环境变量上添加了 C:\MinGW\bin .

test.c

#include <stdio.h>
int main()
{
  printf("Hello");
  return 0;
}

当我编译这个:

gcc test.c -o test.exe

但我得到了这个错误,

test.c:在函数'main'中:test.c:5:12:警告:字符常量对于其类型太长[由defau lt启用] test.c:5:5:警告:传递'printf的参数1 '使用整数生成指针[默认情况下启用] c:\ mingw \ bin ../ lib / gcc / mingw32 / 4.6.2 /../../../../ include / stdio.h :294:37:注意:预期'const char *'但参数类型为'int'

请原谅诺布,努力学习有 Value 的东西 . 谢谢!

1 回答

  • 4

    您获得的错误消息与GCC将为以下代码生成的错误消息完全匹配:

    #include <stdio.h>
    int main()
    {
      printf('Hello');
      return 0;
    }
    

    这是双引号被单引号取代 .

    使用记事本或更好的记事本来检查发生了什么 .

相关问题