lundi 13 juillet 2020

ERROR:

I'm trying to run a piece of code in Visual Studio Code, on macOS Catalina. The code:

#include <bits/stdc++.h>
using namespace std;

int main() 
{ 
    // Create an empty vector 
    vector<int> vect;  
     
    vect.push_back(10); 
    vect.push_back(20); 
    vect.push_back(30); 
  
    for (int x : vect) 
        cout << x << " "; 
  
    return 0; 
} 

When I try to run the code using the coderunner extension, I get the error:

[Running] cd "/Users/VSC_Files/" && g++ -std=c++17 helloworld.cpp -o helloworld && "/Users/VSC_Files/"helloworld
In file included from helloworld.cpp:1:
/usr/local/include/bits/stdc++.h:57:10: fatal error: 'cstdalign' file not found
#include <cstdalign>
         ^~~~~~~~~~~
1 error generated.

[Done] exited with code=1 in 1.465 seconds

Apparently this is an error only for C++11, then why am I getting this error? I have the latest updated Xcode version and the latest stable build of VSCode too. Please help!

Aucun commentaire:

Enregistrer un commentaire