鱼C论坛

 找回密码
 立即注册
查看: 2284|回复: 23

[已解决]VSCode 安装问题

[复制链接]
发表于 2020-12-6 09:43:38 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能^_^

您需要 登录 才可以下载或查看,没有账号?立即注册

x
       由于 VS2015 不能使用变长数组,于是,安装了 DEV_C++,可是不知为何,原来在 32 位系统中可以正常使用的软件,在 WIN10 系统中安装,就是不能运行。故想到了安装 VSCode ,几经折磨,终于看到了一点曙光,但还有最后一公里路没有走完,请朋友们帮忙。谢谢大家!
最佳答案
2020-12-10 14:54:18
本帖最后由 jitianmoshen 于 2020-12-10 15:00 编辑

{
    "configurations": [
        {
            "name": "Win32",
            "includePath": [
                "${workspaceFolder}/**"
            ],
            "defines": [
                "_DEBUG",
                "UNICODE",
                "_UNICODE"
            ],
            "windowsSdkVersion": "10.0.18362.0",
            "compilerPath": "你自己的",
            "cStandard": "c17",
            "cppStandard": "c++17",
            "intelliSenseMode": "msvc-x64"
        }
    ],
    "version": 4
}
@风过无痕1989
VSCode.jpg
小甲鱼最新课程 -> https://ilovefishc.com
回复

使用道具 举报

发表于 2020-12-6 10:32:41 | 显示全部楼层
VS好像都不支持变长数组,可以这样
  1. #define MAX 100
  2.     int array[MAX]
  3.     scanf("%d", &n);
  4.     for(; ;)
  5.     {
  6.           scanf("%d", &array[i])
  7.     }
复制代码
小甲鱼最新课程 -> https://ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2020-12-6 10:35:38 | 显示全部楼层
本帖最后由 jitianmoshen 于 2020-12-6 10:39 编辑

报错的时候点打开launch.json
  1. {
  2.     "version": "0.2.0",
  3.     "configurations": [
  4.         {
  5.             "name": "gcc.exe - 生成和调试活动文件",
  6.             "type": "cppdbg",
  7.             "request": "launch",
  8.             "program": "${fileDirname}\\${fileBasenameNoExtension}.exe",
  9.             "args": [],
  10.             "stopAtEntry": false,
  11.             "cwd": "${workspaceFolder}",
  12.             "environment": [],
  13.             "externalConsole": false,
  14.             "MIMode": "gdb",
  15.             "miDebuggerPath": "C:\\mingw64\\bin\\gdb.exe",     //根据你自己的路径改
  16.             "setupCommands": [
  17.                 {
  18.                     "description": "为 gdb 启用整齐打印",
  19.                     "text": "-enable-pretty-printing",
  20.                     "ignoreFailures": true
  21.                 }
  22.             ],
  23.             "preLaunchTask": "C/C++: gcc.exe build active file"
  24.         }
  25.     ]
  26. }
复制代码

然后在同一个文件夹下新建tasks.json,有的话就编辑
  1. {
  2.     "tasks": [
  3.         {
  4.             "type": "shell",
  5.             "label": "C/C++: gcc.exe build active file",
  6.             "command": "C:\\mingw64\\bin\\gcc.exe",             //根据你自己的路径改
  7.             "args": [
  8.                 "-D__USE_MINGW_ANSI_STDIO = 1",    //防止无法输出long double或其他,
  9.                 "-g",
  10.                 "${file}",
  11.                 "-o",
  12.                 "${fileDirname}\\${fileBasenameNoExtension}.exe"
  13.             ],
  14.             "options": {
  15.                 "cwd": "${workspaceFolder}"
  16.             },
  17.             "problemMatcher": [
  18.                 "$gcc"
  19.             ],
  20.             "group": {
  21.                 "kind": "build",
  22.                 "isDefault": true
  23.             }
  24.         }
  25.     ],
  26.     "version": "2.0.0"
  27. }
复制代码

settings.json
  1. {
  2.     "clang.diagnostic.enable": false,     //这个是关于CLANG报错的,没有可不管
  3.     "files.associations":
  4.     {
  5.         "1.C": "cpp",
  6.         "cstdio": "c",
  7.     }   
  8. }
复制代码
小甲鱼最新课程 -> https://ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2020-12-6 10:44:54 | 显示全部楼层
看你文件好像没有.c的后缀。
VSCODE用变长也会警告,不过似乎能用
VSCODE用scanf输入中文的不能显示出来,没搜到解决办法
小甲鱼最新课程 -> https://ilovefishc.com
回复 支持 反对

使用道具 举报

 楼主| 发表于 2020-12-6 11:36:57 | 显示全部楼层
jitianmoshen 发表于 2020-12-6 10:35
报错的时候点打开launch.json

然后在同一个文件夹下新建tasks.json,有的话就编辑

你这个 launch.json、tasks.json、我看过,settings.json 是抄你的,但运行时还是说打不开文件
小甲鱼最新课程 -> https://ilovefishc.com
回复 支持 反对

使用道具 举报

 楼主| 发表于 2020-12-6 11:38:25 | 显示全部楼层
jitianmoshen 发表于 2020-12-6 10:44
看你文件好像没有.c的后缀。
VSCODE用变长也会警告,不过似乎能用
VSCODE用scanf输入中文的不能显示出来 ...

好像自动保存的是一个文本文件,后缀是 .txt
小甲鱼最新课程 -> https://ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2020-12-6 11:56:44 | 显示全部楼层
风过无痕1989 发表于 2020-12-6 11:36
你这个 launch.json、tasks.json、我看过,settings.json 是抄你的,但运行时还是说打不开文件

settings你可以不用弄
小甲鱼最新课程 -> https://ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2020-12-6 11:57:33 | 显示全部楼层
本帖最后由 jitianmoshen 于 2020-12-6 11:59 编辑
风过无痕1989 发表于 2020-12-6 11:38
好像自动保存的是一个文本文件,后缀是 .txt


新建文件的时候可以输入后缀啊, 比如hello.c
QQ截图20201206115926.jpg
小甲鱼最新课程 -> https://ilovefishc.com
回复 支持 反对

使用道具 举报

 楼主| 发表于 2020-12-6 13:30:21 | 显示全部楼层
jitianmoshen 发表于 2020-12-6 11:57
新建文件的时候可以输入后缀啊, 比如hello.c

改为 .c 以后,现在是 include 的问题了
小甲鱼最新课程 -> https://ilovefishc.com
回复 支持 反对

使用道具 举报

 楼主| 发表于 2020-12-6 14:51:13 | 显示全部楼层
巴巴鲁 发表于 2020-12-6 10:32
VS好像都不支持变长数组,可以这样

就是不想用宏定义,才去安装 VSCode 的呀
小甲鱼最新课程 -> https://ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2020-12-7 19:36:39 | 显示全部楼层
好像 还没有解决问题,帮你顶一下
小甲鱼最新课程 -> https://ilovefishc.com
回复 支持 反对

使用道具 举报

 楼主| 发表于 2020-12-7 21:14:54 | 显示全部楼层
乐乐学编程 发表于 2020-12-7 19:36
好像 还没有解决问题,帮你顶一下


是呀,还不能正常运行,谢谢你帮顶上来。现在到了这一步了,include 好像设置不对,请朋友们指导
VSCode.jpg
小甲鱼最新课程 -> https://ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2020-12-10 14:13:53 | 显示全部楼层
风过无痕1989 发表于 2020-12-7 21:14
是呀,还不能正常运行,谢谢你帮顶上来。现在到了这一步了,include 好像设置不对,请朋友们指导

你把.vscode里面的都贴出来吧,你发哪了
小甲鱼最新课程 -> https://ilovefishc.com
回复 支持 反对

使用道具 举报

 楼主| 发表于 2020-12-10 14:23:50 | 显示全部楼层
jitianmoshen 发表于 2020-12-10 14:13
你把.vscode里面的都贴出来吧,你发哪了

launch.json
  1. {
  2.   // 使用 IntelliSense 了解相关属性。
  3.   // 悬停以查看现有属性的描述。
  4.   // 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387
  5.   "version": "0.2.0",
  6.   "configurations": [
  7.     {
  8.       "name": "gcc.exe - 生成和调试活动文件",
  9.       "type": "cppdbg",
  10.       "request": "launch",
  11.       "program": "${fileDirname}\\${fileBasenameNoExtension}.exe",
  12.       "args": [],
  13.       "stopAtEntry": false,
  14.       "cwd": "C:\\Users\\Administrator\\AppData\\Local\\Programs\\Microsoft VS Code\\mingw64\\bin",
  15.       "environment": [],
  16.       "externalConsole": false,
  17.       "MIMode": "gdb",
  18.       "miDebuggerPath": "C:\\Users\\Administrator\\AppData\\Local\\Programs\\Microsoft VS Code\\mingw64\\bin\\gdb.exe",
  19.       "setupCommands": [
  20.         {
  21.           "description": "为 gdb 启用整齐打印",
  22.           "text": "-enable-pretty-printing",
  23.           "ignoreFailures": true
  24.         }
  25.       ],
  26.       "preLaunchTask": "C/C++: gcc.exe build active file"
  27.     }
  28.   ]
  29. }
复制代码


tasks.json
  1. {
  2.   // See https://go.microsoft.com/fwlink/?LinkId=733558
  3.   // for the documentation about the tasks.json format
  4.   "version": "2.0.0",
  5.   "tasks": [
  6.     {
  7.       "label": "build",
  8.       "type": "shell",
  9.       "command": "msbuild",
  10.       "args": [
  11.         // Ask msbuild to generate full paths for file names.
  12.         "/property:GenerateFullPaths=true",
  13.         "/t:build",
  14.         // Do not generate summary otherwise it leads to duplicate errors in Problems panel
  15.         "/consoleloggerparameters:NoSummary"
  16.       ],
  17.       "group": "build",
  18.       "presentation": {
  19.         // Reveal the output only if unrecognized errors occur.
  20.         "reveal": "silent"
  21.       },
  22.       // Use the standard MS compiler pattern to detect errors, warnings and infos
  23.       "problemMatcher": "$msCompile"
  24.     }
  25.   ]
  26. }
复制代码


settings.json
  1. {
  2.     "files.associations": {
  3.     "*.vue": "vue",
  4.     "*.wpy": "vue",
  5.     "*.wxml": "html",
  6.     "*.wxss": "css"
  7.     },
  8.     "terminal.integrated.shell.windows": "C:\\Windows\\System32\\cmd.exe",
  9.     "git.enableSmartCommit": true,
  10.     "git.autofetch": true,
  11.     "emmet.triggerExpansionOnTab": true,
  12.     "emmet.showAbbreviationSuggestions": true,
  13.     "emmet.showExpandedAbbreviation": "always",
  14.     "emmet.includeLanguages": {
  15.     "vue-html": "html",
  16.     "vue": "html",
  17.     "wpy": "html"
  18.     },
  19.     //主题颜色
  20.     //"workbench.colorTheme": "Monokai",
  21.     "git.confirmSync": false,
  22.     "explorer.confirmDelete": false,
  23.     "editor.fontSize": 14,
  24.     "window.zoomLevel": 1,
  25.     "editor.wordWrap": "on",
  26.     "editor.detectIndentation": false,
  27.     // 重新设定tabsize
  28.     "editor.tabSize": 2,
  29.     //失去焦点后自动保存
  30.     "files.autoSave": "onFocusChange",
  31.     // #值设置为true时,每次保存的时候自动格式化;
  32.     "editor.formatOnSave": false,
  33.      //每120行就显示一条线
  34.     "editor.rulers": [
  35.     ],
  36.     // 在使用搜索功能时,将这些文件夹/文件排除在外
  37.     "search.exclude": {
  38.         "**/node_modules": true,
  39.         "**/bower_components": true,
  40.         "**/target": true,
  41.         "**/logs": true,
  42.     },
  43.     // 这些文件将不会显示在工作空间中
  44.     "files.exclude": {
  45.         "**/.git": true,
  46.         "**/.svn": true,
  47.         "**/.hg": true,
  48.         "**/CVS": true,
  49.         "**/.DS_Store": true,
  50.         "**/*.js": {
  51.             "when": "$(basename).ts" //ts编译后生成的js文件将不会显示在工作空中
  52.         },
  53.         "**/node_modules": true
  54.     },
  55.     // #让vue中的js按"prettier"格式进行格式化
  56.     "vetur.format.defaultFormatter.html": "js-beautify-html",
  57.     "vetur.format.defaultFormatter.js": "prettier",
  58.     "vetur.format.defaultFormatterOptions": {
  59.         "js-beautify-html": {
  60.             // #vue组件中html代码格式化样式
  61.             "wrap_attributes": "force-aligned", //也可以设置为“auto”,效果会不一样
  62.             "wrap_line_length": 200,
  63.             "end_with_newline": false,
  64.             "semi": false,
  65.             "singleQuote": true
  66.         },
  67.         "prettier": {
  68.             "semi": false,
  69.             "singleQuote": true
  70.         }
  71.     },
  72.     "update.mode": "none",
  73.     "editor.suggest.snippetsPreventQuickSuggestions": false,
  74.     "C_Cpp.intelliSenseEngineFallback": "Enabled",
  75.     "C_Cpp.clang_format_sortIncludes": true,
  76.     "C_Cpp.default.includePath": [
  77.       "C:\\Users\\Administrator\\AppData\\Local\\Programs\\Microsoft VS Code\\mingw64\\include"
  78.     ],
  79.     "C_Cpp.default.cStandard": "c99"
  80.   }
复制代码
小甲鱼最新课程 -> https://ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2020-12-10 14:29:07 | 显示全部楼层
settings没什么用,  还有个c_cpp_properties.json呢,你那里没有吗
小甲鱼最新课程 -> https://ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2020-12-10 14:29:37 | 显示全部楼层


settings没什么用,  还有个c_cpp_properties.json呢,你那里没有吗
小甲鱼最新课程 -> https://ilovefishc.com
回复 支持 反对

使用道具 举报

 楼主| 发表于 2020-12-10 14:30:27 | 显示全部楼层
jitianmoshen 发表于 2020-12-10 14:29
settings没什么用,  还有个c_cpp_properties.json呢,你那里没有吗

没有匹配命令
小甲鱼最新课程 -> https://ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2020-12-10 14:40:26 | 显示全部楼层
你的settings可以清空了,然后看这个
https://blog.csdn.net/baidu_38634017/article/details/99875321
小甲鱼最新课程 -> https://ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2020-12-10 14:41:16 | 显示全部楼层
小甲鱼最新课程 -> https://ilovefishc.com
回复 支持 反对

使用道具 举报

 楼主| 发表于 2020-12-10 14:50:35 | 显示全部楼层

"name": "Linux", 可我的系统是 windows 不是 Linux
小甲鱼最新课程 -> https://ilovefishc.com
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Archiver|鱼C工作室 ( 粤ICP备18085999号-1 | 粤公网安备 44051102000585号)

GMT+8, 2025-5-2 11:43

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表