도로의 내 전체 스택 -C 구축 언어 통합 개발 환경의 기초
2.1 C 구축 언어 통합 개발 환경
현재 주류 운영 체제 (윈도우, 리눅스, 맥 OS)를 편집, 컴파일, 디버깅, 배포 패키지 C 프로그램의 C 언어 통합 개발 환경을 개선했다.
운영 체제 | 개발 도구 |
---|---|
윈도우 10 1903 | 비주얼 Studio2019 |
macOS10.14 | XCode10.3 |
Ubuntu18.04 | QT5.13 |
Windows는 세계에서 가장 인기있는 데스크톱 운영 체제, 최신 버전의 윈도우 10 1903로, 가장 강력한 통합 개발 환경으로 Windows에서으로 VisualStudio는, 등등 최신 버전 VisualStudio2019 16.2.2를 Windows 소프트웨어, 게임, 웹 애플리케이션을 개발하고 있습니다.
우분투 권장, C / C ++ 프로그램을 작성하는 QT 크로스 플랫폼 통합 개발 환경에서 가장 인기있는 데스크톱 리눅스 시스템의 하나입니다.
맥 OS 플랫폼은 C / C ++ 프로그램을 작성 엑스 코드를 사용하는 것이 좋습니다, 그리고 맥 OS 시스템에서 엑스 코드는 내장하지-에, 추가 설치를.
![엑스 코드 엑스 코드](./images/1566614028266.png)
일부 크로스 플랫폼 C 외에도 / C ++ 개발 도구, JetBrains의 회사에서 같은 CLion는 C / C ++ 프로그램을 작성하는 데 사용할 수 있습니다.
설치 및 IDE를 사용하여, 자신의 공식 웹 사이트는 자세한 튜토리얼을 제공, 학생들은 자신의 검사에 갈 수 있습니다.
달리 지정되지 않은 경우 C 언어 학습 과정은 주로 윈도우 10 1903 + 비주얼 스튜디오 2019 개발 환경을 사용하는 기본 환경은 윈도우 10 1903 및 Visual Studio 2019입니다.
하여 HelloWorld을 달성하기 위해 2.2 비주얼 스튜디오 코드 C 언어
하여 HelloWorld 당신이 독립적으로 작성하여 HelloWorld를 실행할 수 있는지, 프로그래밍 언어 항목의 절차를 배우는 것입니다, 그것은 그 문의 프로그램을 입력 것을 의미한다.
비주얼 스튜디오 코드는 여기에 C 언어로 소스 코드를 작성하는 데 사용할 마이크로 소프트의 오픈 소스, 크로스 플랫폼 (윈도우, 우분투, 맥 OS) 편집기입니다.
为什么首先要使用Visual Studio Code来编写第一个C程序呢,因为Visual Studio Code只是一个编辑器,用于编写源码,并不提供编译或者解释运行程序的功能。通过它来对比之前介绍的IDE,体验下使用IDE开发程序带来的好处,也有利于理解IDE背后的机制。
- 在D盘的code目录下创建源文件helloworld.c,C语言的源文件都是以.c结尾的。
编辑源文件
#include <stdio.h>
int main(int argc, char* argv[]) {
printf("Hello World Windows10 1903 & Visual Studio Code & C ");
return 0;
}
- 编译源文件
将源文件编译成对应平台的可执行程序,因为计算机不能识别开发人员编写的源文件内容,只能识别二进制的机器指令。而C语言编写的源程序可以使用多种编译器来编译:Windows系统可以安装QT或者Visual Studio 2019后编译源文件
QT中自带了GCC编译器,以QT5.13为例,将QT的默认安装路径(C:\Qt\Qt5.13.0\Tools\mingw730_64\bin) 添加到系统的PATH环境目录下
然后在Windows命令行的终端中输入gcc -v,看到类似如下输出,就可以使用gcc编译器了
C:\Users\ittim>gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=C:/Qt/Qt5.13.0/Tools/mingw730_64/bin/../libexec/gcc/x86_64-w64-mingw32/7.3.0/lto-wrapper.exe
Target: x86_64-w64-mingw32
Configured with: ../../../src/gcc-7.3.0/configure --host=x86_64-w64-mingw32 --build=x86_64-w64-mingw32 --target=x86_64-w64-mingw32 --prefix=/mingw64 --with-sysroot=/c/mingw730/x86_64-730-posix-seh-rt_v5-rev0/mingw64 --enable-shared --enable-static --disable-multilib --enable-languages=c,c++,fortran,lto --enable-libstdcxx-time=yes --enable-threads=posix --enable-libgomp --enable-libatomic --enable-lto --enable-graphite --enable-checking=release --enable-fully-dynamic-string --enable-version-specific-runtime-libs --enable-libstdcxx-filesystem-ts=yes --disable-libstdcxx-pch --disable-libstdcxx-debug --enable-bootstrap --disable-rpath --disable-win32-registry --disable-nls --disable-werror --disable-symvers --with-gnu-as --with-gnu-ld --with-arch=nocona --with-tune=core2 --with-libiconv --with-system-zlib --with-gmp=/c/mingw730/prerequisites/x86_64-w64-mingw32-static --with-mpfr=/c/mingw730/prerequisites/x86_64-w64-mingw32-static --with-mpc=/c/mingw730/prerequisites/x86_64-w64-mingw32-static --with-isl=/c/mingw730/prerequisites/x86_64-w64-mingw32-static --with-pkgversion='x86_64-posix-seh-rev0, Built by MinGW-W64 project' --with-bugurl=https://sourceforge.net/projects/mingw-w64 CFLAGS='-O2 -pipe -fno-ident -I/c/mingw730/x86_64-730-posix-seh-rt_v5-rev0/mingw64/opt/include -I/c/mingw730/prerequisites/x86_64-zlib-static/include -I/c/mingw730/prerequisites/x86_64-w64-mingw32-static/include' CXXFLAGS='-O2 -pipe -fno-ident -I/c/mingw730/x86_64-730-posix-seh-rt_v5-rev0/mingw64/opt/include -I/c/mingw730/prerequisites/x86_64-zlib-static/include -I/c/mingw730/prerequisites/x86_64-w64-mingw32-static/include' CPPFLAGS=' -I/c/mingw730/x86_64-730-posix-seh-rt_v5-rev0/mingw64/opt/include -I/c/mingw730/prerequisites/x86_64-zlib-static/include -I/c/mingw730/prerequisites/x86_64-w64-mingw32-static/include' LDFLAGS='-pipe -fno-ident -L/c/mingw730/x86_64-730-posix-seh-rt_v5-rev0/mingw64/opt/lib -L/c/mingw730/prerequisites/x86_64-zlib-static/lib -L/c/mingw730/prerequisites/x86_64-w64-mingw32-static/lib '
Thread model: posix
gcc version 7.3.0 (x86_64-posix-seh-rev0, Built by MinGW-W64 project)
gcc编译源文件并运行生成的可执行文件
D:\code>dir
驱动器 D 中的卷是 DATA
卷的序列号是 B0FB-1B0A
D:\code 的目录
2019/08/18 10:48 <DIR> .
2019/08/18 10:48 <DIR> ..
2019/08/18 10:46 159 helloworld.c
1 个文件 159 字节
2 个目录 205,122,088,960 可用字节
D:\code>gcc helloworld.c -o helloworld.exe
D:\code>helloworld.exe
Hello World Windows10 1903 & Visual Studio Code & C
Visual Stuido 2019只需要在路径C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Visual Studio 2019\Visual Studio Tools下运行 Developer Command Prompt for VS2019后 使用cl命令编译源文件命令即可。
![비주얼 스튜디오 2019 컴파일하고 C 프로그램을 실행합니다 비주얼 스튜디오 2019 컴파일하고 C 프로그램을 실행합니다](./images/1566614380579.png)
**********************************************************************
** Visual Studio 2019 Developer Command Prompt v16.2.2
** Copyright (c) 2019 Microsoft Corporation
**********************************************************************
C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise>d:
D:\>cd code
D:\code>cl helloworld.c
用于 x86 的 Microsoft (R) C/C++ 优化编译器 19.22.27905 版
版权所有(C) Microsoft Corporation。保留所有权利。
helloworld.c
Microsoft (R) Incremental Linker Version 14.22.27905.0
Copyright (C) Microsoft Corporation. All rights reserved.
/out:helloworld.exe
helloworld.obj
D:\code>helloworld.exe
Hello World macOS & Visual Studio Code & C
2.3 Visual Studio 2019集成GitHub
在正式使用Visual Studio 2019开发C语言的程序时,可以集成GitHub插件,编译后期代码统一管理。
Github에서 플랫폼을 호스팅 오픈 소스 프로젝트, 당신은 처음 사용하기 전에 계정을 생성해야합니다. 에 따라 모든 소스 파일은 GitHub의 C 프로그램에 업로드됩니다, 그래서 그냥 로컬 GitHub의 프로젝트에 원격에서 대체 컴퓨터, 복제 할 경우에도 마찬가지입니다.
- 비주얼 스튜디오 2019을 시작합니다
- GitHub의 플러그 - 비주얼 스튜디오 다운로드하는
비주얼 스튜디오 메뉴 확장을 클릭 -> 관리 확장
그런 다음, 온라인 클릭 Visual Studio를 클릭 다운로드 GitHub의 확장을 선택합니다.
- GitHub의이 설치된에서 플러그인
나중에 비주얼 스튜디오 2019 플러그인은 GitHub에 수동으로 비주얼 스튜디오 2019 닫아야합니다 다운로드하고 자동으로 설치 프로세스를 시작합니다
![사용자 계정 컨트롤 사용자 계정 컨트롤](./images/1566615012926.png)
당신이 2 차원 코드 다운로드 아래를 스캔 할 수 있습니다, 슈퍼 느린 네트워크의 이유로 다운로드가 발생하는 경우이 시점에서 Visual Studio에서 다운로드 플러그인 네트워킹 GitHub의로 이동합니다
![비주얼 스튜디오 바이 네트워크 디스크 다운로드 GitHub의 확장 비주얼 스튜디오 바이 네트워크 디스크 다운로드 GitHub의 확장](./images/1566615029066.png)
다음 닫기 VisualStudio2019는 C를 입력 : \의 Program Files (x86) \ 마이크로 소프트 비주얼 스튜디오에서 \ 2019 기업 \ \ Common7 \ IDE의 디렉토리에 cmd를 입력
![cmd를 cmd를](./images/1566615069684.png)
이 시점에서 그것은 C 입력했다 : 마이크로 소프트 비주얼 스튜디오 \ 기업 \에서 Common7 \ IDE 디렉토리 \ 2019 \ \ 프로그램 파일 (86)을, 단지 VSIXInstaller.exe C를 입력 : \ 사용자 \ ittim 바탕 화면 \ GitHub.VisualStudio.vsix \ 다시 자동차는 플러그 GitHub의 설치를 시작 할 수 있습니다 후
![설치를 수행 설치를 수행](./images/1566615083702.png)
![설치를 시작 설치를 시작](./images/1566615096701.png)
![설치를 완료 설치를 완료](./images/1566615105282.png)
- 연결 GitHub의
GitHub의 플러그인 설치가 완료되면, 비주얼 스튜디오 2019를 다시 시작
첫째, 프로젝트는 연결 GitHub의를 탐색기를 팀, 클릭합니다 솔루션 탐색기로 전환
-
GitHub의 로그인
사용자 이름과 GitHub의에 로그인 할 때 비밀번호를
-
창고를 만들기
첫 번째 메뉴 만들기를 클릭합니다
그런 다음 창고의 이름, 설명 및 로컬 저장소 경로를 설정, 힘내 무시 라이센스
모두가 잘된다면, 단순히 학생들이 계정에 ittimeline 할 대체, 주소 https://github.com/ittimeline/c-core-programming 프로젝트에 액세스하는 브라우저를 사용하여 액세스 할 수 있습니다.