缺少终止字符(C,版本 13,Xcode + 终端)

missing terminating ' character (C, version 13, Xcode + Terminal)

我刚开始接触 C,这是我尝试使用 gcc 使编译器达到 运行 的代码:

#include <stdio.h>

main()

{

printf("hello, world\n");

}

每次输入gcc helloworld.chelloworld.c是源文件名),都会出现如下错误信息:

helloworld.c:1:1: error: expected identifier or '('
{\rtf1\ansi\ansicpg1252\cocoartf2580
^
helloworld.c:13:9: warning: missing terminating ' character [-Winvalid-pp-token]
printf(\'93hello, \'93);\
        ^
1 warning and 1 error generated.

我尝试切换到单引号并在每个字符周围加上引号,但没有任何效果。有谁知道语法有什么问题吗?

尝试手写程序。如果你从某个地方复制粘贴它,你可能会放一些奇怪的不可见字符和格式的东西。我从您的示例中复制粘贴了代码,它工作得很好。使用 GCC 成功编译:

gcc input.c -o program