åèURL
2024年版初心者向けのC++環境構築(Mac + vscode + gcc、競プロ用) #VSCode - Qiita
å®æ½ããæé
$ brew install gcc
ä¸è¨ã®ãããªåºåãåºãã
$ ls -la /usr/local/bin|grep g++ lrwxr-xr-x@ 1 â¯â¯â¯â¯ admin 33 6 23 10:37 g++-14 -> ../Cellar/gcc/14.1.0_1/bin/g++-14 lrwxr-xr-x@ 1 â¯â¯â¯â¯ admin 55 6 23 10:37 x86_64-apple-darwin23-g++-14 -> ../Cellar/gcc/14.1.0_1/bin/x86_64-apple-darwin23-g++-14
ä¸è¨ã®è¨äºãè¦ãã¨ãã©ãããããã©ã«ãã§ã clang ã¨ãããã®ãå ¥ã£ã¦ãããã競æããã°ã©ãã³ã°ã¨ãããéã«ãgcc ã®æ¹ã便å©ãªãã¨ãå¤ãããã§ããããã®ããã«ã»ããã¢ãããã¦ããã
[macOS Monterey] ClangからGCCへの切り替え #Mac - Qiita
$ sudo ln -s ../Cellar/gcc/14.2.0_1/bin/g++-14 /usr/local/bin/gcc $ sudo ln -s ../Cellar/gcc/14.2.0_1/bin/x86_64-apple-darwin23-g++-14 /usr/local/bin/g++ $ echo 'export PATH="/usr/local/bin:$PATH"' >> ~/.zshrc $ source ~/.zshrc $ which gcc /usr/local/bin/gcc $ which g++ /usr/local/bin/g++
Cpp ã®ãã¡ã¤ã«ã®å®è¡æ¹æ³ãµã³ãã«
#include<bits/stdc++.h> using namespace std; int main () { cout << "Hello World!" << endl; }
$ g++ test.cpp && ./a.out Hello World!