티스토리 뷰

c, c++

c 언어 윈도우 vscode 에서 환경설정하기

니냐니 ค^•ﻌ•^ค 2020. 9. 10. 00:24

MinGW download


1. MinGW 설치경로

https://sourceforge.net/projects/mingw/

 

4가지 패키지 설치하면 됨.

 

MinGW Installation Manager → 패키지 선택  Apply Changes

   mingw-developer-toolkit

   mingw32-base

   mingw32-gcc-g++

   msys-base (우분투  같은 환경)

 

2. 환경변수 설정

( 내PC / 내컴퓨터 → 속성 → 고급 시스템 설정 → 시스템 속성 → 환경 변수)

3. 사용자변수, 시스템 변수 둘다

(Path → 편집 → 새로 만들기 → C:\MinGW\bin → 확인)

4. 설치 및 경로 설정 확인 (확인단계)

명령프롬프트 관리자로 틀고 g++ -v (// 아니면 --version도 가능) 입력

 

 


Code Runner download


1. setting JSON 설정

<들어가는 방법>

 

아래 내용을 붙여 넣기. Json에 추가.

1

2

3

4

5

6

7

// Code Runner "CPP" 설정

  "code-runner.executorMap": {

    "cpp": "cd $dir && g++ $fileName -o $fileNameWithoutExt && $dir$fileNameWithoutExt",

    "c": "cd $dir && gcc $fileName -o $fileNameWithoutExt && $dir$fileNameWithoutExt",

  },

  // Window 10 에서는 기본적으로 설정값이 () Default Shell 이 ) Powershell이기

  // 때문에 cmd로 변경해야 정상적으로 실행 됨. 위에를 주석처리 해줬다.

  "terminal.integrated.shell.windows": "C:\\Windows\\sysnative\\cmd.exe"

Colored by Color Scripter

cs

 

 


 

 

 

우클릭 → Run Code → 실행 확인

 

 

출처: <https://tlo-developer.tistory.com/92>

 

 

##여기서 파일 내에 생기는 lauch json이 아니라

전체적 사용자 설정에 들어가서 설정해야지만 된다. // 이거 하고 나서 됐는데.. 



Windows Clang 설치하기


 

Clang은 LLVM 프로텍트의 컴파일러입니다.

C, C++ Obj-C를 지원하는 컴파일러입니다.

GCC와 달리, 소스코드 공개 의무가 없습니다.

 

# 리눅스

리눅스의 경우, 사용 중인 패키지 관리자를 통해 설치하시면 됩니다.

1. 다운로드 경로

http://releases.llvm.org/download.html 에서 Pre-Built Binaries에서 원하는 버전을 골라 다운로드하면 됩니다.

(설치시에 V3 lite에서 예외 검사 적용을 누른 후에 설치가 진행됨.)

 

2. PATH 환경변수

설치 과정 중 PATH 환경변수를 추가하냐는 옵션이 있는데, 이미 사용하는 컴파일러가 있는 게 아닌 이상 추가하는 것이 좋습니다. 

      환경변수를 추가하려면 Add LLVM to the system PATH for all users로 체크해주세요 (두 번째)

3. 설치 확인

CMD를 켜고, clang --version 명령어를 입력 시 clang의 버전 정보가 나타나면 설치가 된 것입니다.

(설치를 하였으나, 환경변수 등록을 안 하면 안 뜹니다)

GCC와 마찬가지로

include 파일은 [설치한 경로]\LLVM\include

lib 파일은 [설치한 경로]\LLVM\lib

컴파일러들은 [설치한 경로]\LLVM\bin

에 존재합니다.

 

출처: <https://vl0011.tistory.com/16>

 


# include <cs50.h> 이용하기


1.  Docker설치

cs50.readthedocs.io/ide/offline/

 

Offline — CS50 Docs

Starting the IDE If you can’t access your CS50 IDE (e.g., after restarting your computer), it’s possibly because it’s stopped. To start it back, open up a terminal window (if using Mac), a command prompt (if using <>), or Docker QuickStart Terminal (

cs50.readthedocs.io

docker를 다운받는다.

hub.docker.com/editions/community/docker-ce-desktop-windows/

 

Docker Desktop for Windows - Docker Hub

Docker Desktop for Windows Docker Desktop for Windows is Docker designed to run on Windows 10. It is a native Windows application that provides an easy-to-use development environment for building, shipping, and running dockerized apps. Docker Desktop for W

hub.docker.com

그다음 

command 창에 그대로 입력하고, 

1 docker run --privileged -e "IP=127.0.0.1" -e "PORT=8080" --name ide50 -d -p 5050:5050 -p 8080-8082:8080-8082 cs50/ide

 

그다음 

localhost를 윈도우에 입력하면 아래와같이 뜬다. 

그럼 Docker를 설치 된 것.

 

 

댓글