这两天安装了vs code 使用了几次感觉非常不错,智能.
windows 10 64位.
比如我自己在电脑安装了cygwin bin目录加入到环境变量
我想用vs编写c程序,首先在vs下面打开一个文件夹,
新建一个Hello.c的文件, 编辑器会提示你找不到.h文件,这时候根据提示信息,点击小灯泡.
会在当前文件夹创建一个配置文件夹,会有下面这个文件. 配置win32节点,把左右include文件夹放进去. 就能自动提示了. 非常方便.
c_cpp_properties.json
{ "configurations": [ { "name": "Win32", "includePath": [ "${workspaceRoot}", "D:\\cygwin64\\usr\\include\\", "D:\\cygwin64\\lib\\gcc\\x86_64-pc-cygwin\\6.4.0\\include\\" ], "defines": [ "_DEBUG", "UNICODE" ], "intelliSenseMode": "msvc-x64", "browse": { "path": [ "${workspaceRoot}", "D:\\cygwin64\\usr\\include\\", "D:\\cygwin64\\lib\\gcc\\x86_64-pc-cygwin\\6.4.0\\include\\" ], "limitSymbolsToIncludedHeaders": true, "databaseFilename": "" } } ], "version": 3}
launch.json
{ // 使用 IntelliSense 了解相关属性。 // 悬停以查看现有属性的描述。 // 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387 "version": "0.2.0", "configurations": [ { "name": "(gdb) Launch", "type": "cppdbg", "request": "launch", "program": "${workspaceFolder}\\${fileBasenameNoExtension}.exe", "args": [], "stopAtEntry": false, "cwd": "${workspaceFolder}", "environment": [], "externalConsole": true, "MIMode": "gdb", "miDebuggerPath": "gdb.exe", "setupCommands": [ { "description": "Enable pretty-printing for gdb", "text": "-enable-pretty-printing", "ignoreFailures": true } ] } ]}
如何调试,还没实验.