C语言快速入门一:win10系统环境搭建

2021-06-27 11:05

阅读:412

标签:说明   try   ror   验证   -shared   cmd命令   1.0   stat   配置环境变量   

0、搭建环境:WIN10 64位

1.下载minGW.zip编译器

2.解决上述文件,配置环境变量

3.配置变成后验证:打开cmd命令行,输入gcc -v 提示以下内容,说明编译器安装成功

D:\mm>gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=D:/dm/mingw/mingw64/bin/../libexec/gcc/x86_64-w64-mingw32/7.1.0/lto-wrapper.exe
Target: x86_64-w64-mingw32
Configured with: ../../../src/gcc-7.1.0/configure --host=x86_64-w64-mingw32 --build=x86_64-w64-mingw32 --target=x86_64-w64-mingw32 --prefix=/mingw64 --with-sysroot=/c/mingw710/x86_64-710-posix-seh-rt_v5-rev1/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/mingw710/prerequisites/x86_64-w64-mingw32-static --with-mpfr=/c/mingw710/prerequisites/x86_64-w64-mingw32-static --with-mpc=/c/mingw710/prerequisites/x86_64-w64-mingw32-static --with-isl=/c/mingw710/prerequisites/x86_64-w64-mingw32-static --with-pkgversion=‘x86_64-posix-seh-rev1, Built by MinGW-W64 project‘ --with-bugurl=https://sourceforge.net/projects/mingw-w64 CFLAGS=‘-O2 -pipe -fno-ident -I/c/mingw710/x86_64-710-posix-seh-rt_v5-rev1/mingw64/opt/include -I/c/mingw710/prerequisites/x86_64-zlib-static/include -I/c/mingw710/prerequisites/x86_64-w64-mingw32-static/include‘ CXXFLAGS=‘-O2 -pipe -fno-ident -I/c/mingw710/x86_64-710-posix-seh-rt_v5-rev1/mingw64/opt/include -I/c/mingw710/prerequisites/x86_64-zlib-static/include -I/c/mingw710/prerequisites/x86_64-w64-mingw32-static/include‘ CPPFLAGS=‘ -I/c/mingw710/x86_64-710-posix-seh-rt_v5-rev1/mingw64/opt/include -I/c/mingw710/prerequisites/x86_64-zlib-static/include -I/c/mingw710/prerequisites/x86_64-w64-mingw32-static/include‘ LDFLAGS=‘-pipe -fno-ident -L/c/mingw710/x86_64-710-posix-seh-rt_v5-rev1/mingw64/opt/lib -L/c/mingw710/prerequisites/x86_64-zlib-static/lib -L/c/mingw710/prerequisites/x86_64-w64-mingw32-static/lib ‘
Thread model: posix
gcc version 7.1.0 (x86_64-posix-seh-rev1, Built by MinGW-W64 project)

4.安装notepad++

5.编写第一个helloworld程序

#include int main(void) {

    printf("hello world");

    return 0;

}
6.保存文件为 hello.c 保存至
d:\mm\
7. 编译程序cd d:\mm\目录 输入 gcc hello.c -o hello
8.运行程序在编辑目录输入: hello.exe
完成第一个c语言程序
9.扩展:

echo %errorlevel%
//打印错误级别
type hello.c
//打印文件内容

 

 

C语言快速入门一:win10系统环境搭建

标签:说明   try   ror   验证   -shared   cmd命令   1.0   stat   配置环境变量   

原文地址:https://www.cnblogs.com/51testing/p/9651888.html


评论


亲,登录后才可以留言!