赞
踩
MinGw (Minimalist GNU for Windows),它是把gun的一些头文件以及编译工具入g++,gcc等移植到win平台的产物。但并不是所有的posix API都做了移植。 这一点可以参阅cygwin和Mingw的区别。比如说, /sys/socket.h这样的头文件,在安装过MinGw后仍然是不能使用的,MinGw并没有包含此头文件。
下载MinGW,地址 http://mingw-w64.org/doku.php/start
下载完成之后添加MinGw的环境变量。只需要把MinGw的bin目录加入到环境变量中即可。
然后用powershell运行g++ --version命令验证MinMW已经安装成功。
vs官方文档 里有这三个文件用途以及如何配置的说明。
{ "configurations": [ { "name": "Win32", "includePath": [ "${workspaceFolder}/**" ], "defines": [ "_DEBUG", "UNICODE", "_UNICODE" ], "windowsSdkVersion": "10.0.18362.0", "compilerPath": "C:/Program Files (x86)/mingw-w64/bin/g++.exe", "cStandard": "c89", "cppStandard": "c++98", "intelliSenseMode": "clang-x86" } ], "version": 4 }
{ "version": "2.0.0", "tasks": [ { "type": "shell", "label": "g++.exe build active file", "command": "C:/Program Files (x86)/mingw-w64/bin/g++.exe", "args": [ "-g", "${file}", "-o", "${fileDirname}/${fileBasenameNoExtension}.exe" ], "options": { "cwd": "C:/Program Files (x86)/mingw-w64/bin" }, "problemMatcher": [ "$gcc" ], "group": { "kind": "build", "isDefault": true } } ] }
{ // Use IntelliSense to learn about possible attributes. // Hover to view descriptions of existing attributes. // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 "version": "0.2.0", "configurations": [ { "name": "(gdb) 启动", "type": "cppdbg", "request": "launch", "program": "输入程序名称,例如 ${workspaceFolder}/a.exe", "args": [], "stopAtEntry": false, "cwd": "${fileDirname}", "environment": [], "externalConsole": false, "MIMode": "gdb", "miDebuggerPath": "/path/to/gdb", "setupCommands": [ { "description": "为 gdb 启用整齐打印", "text": "-enable-pretty-printing", "ignoreFailures": true }, { "description": "Set the disassembly flavor to Intel for gdb", "text": "-gdb-set disassembly-flavor intel", "ignoreFailures": true }, { "description": "Test", "text": "python import sys;sys.path.insert(0, '/usr/share/gcc/python');from libstdcxx.v6.printers import register_libstdcxx_printers;register_libstdcxx_printers(None)", "ignoreFailures": false } ] } ] }
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。