简体   繁体   English

尝试在 C 上运行 hello world 并且输出在 VS 上的 Mac 上抛出此错误:zsh: parse error near `&&'

[英]Trying to run hello world on C and the output throwing this error on Mac on VS : zsh: parse error near `&&'

I'm trying to run a simple C Program - Hello World on VSC on my mac.我正在尝试在我的 Mac 上的 VSC 上运行一个简单的 C 程序 - Hello World。 It throws up this error everytime on the output screen, please understand that I'm new to coding and well uh that's that.每次在输出屏幕上都会抛出这个错误,请理解我是编码新手,嗯,就是这样。

Here's the screenshot : The error这是屏幕截图:错误

#include <stdio.h>

int main()
{

    printf("%s", "Hello World");
    return 0;
}

Output : zsh: parse error near `&&'输出:zsh:在`&&'附近解析错误

Your source code itself is correct.您的源代码本身是正确的。 Assuming that is the only source code in your current project, The problem either lies with your non-portable filename, or with a misconfigured or corrupted compiler.假设这是您当前项目中唯一的源代码,问题要么出在不可移植的文件名上,要么出在错误配置或损坏的编译器上。 Change your filename to something that describes the contained source code.将您的文件名更改为描述所包含源代码的名称。 A filename like #include <stdio.h> doesn't just make debugging difficult, but is not even allowed in some operating systems.#include <stdio.h>这样的文件名不仅使调试变得困难,而且在某些操作系统中甚至是不允许的。 While it does appear to be technically supported in your implementation, it could still be causing zsh to behave improperly.虽然它在您的实现中似乎在技术上得到支持,但它仍然可能导致 zsh 行为不正常。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM