Following instructions here, I built and executed the following code under Mac OS 11.6 and VS code 1.61.2. Code unmodified from https://code.visualstudio.com/docs/cpp/config-clang-mac
#include <iostream>
#include <vector>
#include <string>
using namespace std;
int main()
{
vector<string> msg {"Hello", "C++", "World", "from", "VS Code", "and the C++ extension!"};
for (const string& word : msg) {
cout << word << " ";
}
cout << endl;
}
When it executes, Mac OS pops up with the following unexpected question: "helloworld wants permission to access files on the desktop." When denied, the program exited without complaint and without output. When executed directly from the command line, helloworld prints the expected output and does not show the strange behavior.
What the heck? I touched no files! Is my C++ library corrupted with malware? Has anyone else seen this odd behavior?
I finally said yes and it quit asking. Should I change my mind? And where would I go to do so?