본문 바로가기
글/기타

내 PS 환경설정 (기록)

by 유시은 2022. 9. 17.

목표 :

CLion에서 gcc로 컴파일 하고, 파일 입출력 사용하기

1. gcc 설치

export HOMEBREW_NO_ANALYTICS=1
brew update
brew upgrade
brew info gcc
brew install gcc
brew cleanup gcc

2. CLion Toolchains 설정

CLion - Preferences > Build, Execution, Deployment

C++ Compiler에 아래 경로 작성 (그러면 나머지는 자동으로 잡힌다)

/opt/homebrew/Cellar/gcc/12.2.0/bin/g++-12

'▲' 로 맨 위로 올려서 default로 설정하기

3. 파일 입출력 사용하기

cmake-build-debug에 입출력용 파일 만들고,

#include <bits/stdc++.h>
#define all(v) (v).begin(), (v).end()
using namespace std;
using ll = long long;


int a, b;

int solve() {
    return a + b;
}


int main() {
#ifdef ONLINE_JUDGE
    ios::sync_with_stdio(0), cin.tie(0);
#else
    freopen("local.in", "r", stdin);
    freopen("local.out", "w", stdout);
#endif

    cin >> a >> b;
    cout << solve();

}

PS를 합시다.

 

태그

,

댓글0