'VisualStudioCode error:ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation)
//haha.c
#include <stdio.h>
#include "hihi.h"
#include "hihi.h"
int main()
{
opop();
return 0;
}
//hihi.c
#include <stdio.h>
#include "hihi.h"
void opop(){
printf("ssdsd");
}
//hihi.h
void opop();
When I run it on VS Code this is what appears on the terminal:
Executing task: C/C++: gcc build active file <
Starting build... /usr/bin/gcc -g /Users/zhengpeizhou/projects/.vscode/tasks.json -o /Users/zhengpeizhou/projects/.vscode/tasks ld: warning: ignoring file /Users/zhengpeizhou/projects/.vscode/tasks.json, building for macOS-x86_64 but attempting to link with file built for unknown-unsupported file format ( 0x7B 0x0A 0x20 0x20 0x20 0x20 0x22 0x74 0x61 0x73 0x6B 0x73 0x22 0x3A 0x20 0x5B ) 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)
Build finished with error(s). The terminal process failed to launch (exit code: -1).
Terminal will be reused by tasks, press any key to close it.
Can someone please explain? I am still quite new to programming.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
