简体   繁体   English

架构 x86_64 VSCode 错误的未定义符号

[英]Undefined symbols for architecture x86_64 VSCode error

I am trying to fix the error in the following C program, that I get in the terminal in VSCode?我正在尝试修复以下 C 程序中的错误,我在 VSCode 中进入终端?

#include <stdio.h>

main()
{
    printf("just one small step for coders.one giant leap for\n");
    printf("programmers\n");
    return 0;
}

Below is the error that I get while compiling in the VSCode terminal:以下是我在 VSCode 终端中编译时遇到的错误:

Undefined symbols for architecture x86_64:
  "_main", referenced from:
     implicit entry/start for main executable
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Try to put return data type of main function尝试把主要的返回数据类型 function

int main(){

Maybe this is noy solution but this is the only reason that comes to mind.也许这不是解决方案,但这是唯一想到的原因。

You are missing the inclues, this code run for me, and if you are doing everything okay it should run for you:您缺少包含的内容,此代码为我运行,如果您做的一切正常,它应该为您运行:

#include<stdio.h>
#include<stdlib.h>
int main()
{
    printf("just one small step for coders.one giant leap for\n");
    printf("programmers\n");
    return 0;
}

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

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