So I have a problem where when I try to compile a c++ file in vscode. I would do clang Watermelon.cpp in the terminal. This would work fine with the following code
#include <iostream>
using namespace std;
int main() {
int x;
return 0;
}
But once I add cin and cout it throws an error.
#include <iostream>
using namespace std;
int main() {
int x;
cin >> x;
return 0;
}
Error: Undefined symbols for architecture arm64:
"std::__1::basic_istream<char, std::__1::char_traits<char> >::operator>>(int&)", referenced from:
_main in Watermelon-42c4ad.o
"std::__1::cin", referenced from:
_main in Watermelon-42c4`your text`ad.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Running it using VScodes debugger works, but I would like to figure out why this happens when I switch from my school Windows mingGW to clang on my macbook.