Error while compiling in VS Code but not in Xcode

Hi, I am a student and I keep switching between VS Code and Xcode, but now every time I compile a code in VS Code it gives an error --> "clang: error: linker command failed with exit code 1" but the same code can be build successfully in Xcode. How do I fix this error?

Answered by AshishBazad in 742219022

But Xcode is slow while running a program, it takes time to load the program so I wanted to shift on VS Code due to fast loading of program, which helps in my competitive programming.

Please help if you know any way to fix it

BTW, I am adding the error screen shot.

Just use Xcode

Accepted Answer

But Xcode is slow while running a program, it takes time to load the program so I wanted to shift on VS Code due to fast loading of program, which helps in my competitive programming.

Please help if you know any way to fix it

BTW, I am adding the error screen shot.

You might get more help asking where people are using VSCode. Most of the folks on this Apple forum are using tools provided by Apple, while you're asking about a problem with a Microsoft tool. Have you set up your VSCode correctly for C++? See https://code.visualstudio.com/docs/cpp/config-clang-mac.

Thank you very much sir, now everything got fixed. :)

Error while compiling in VS Code but not in Xcode
 
 
Q