Giter Site home page Giter Site logo

Comments (6)

SDchao avatar SDchao commented on September 2, 2024 1

你好,今天我也遇到同样的问题,解决方法是

tasks.json文件修改如下

{
  "version": "2.0.0",
  "command": "g++",
  "type": "shell",
  "presentation": {
    "echo": true,
    "reveal": "always",
    "focus": false,
    "panel": "shared",
    "showReuseMessage": true,
    "clear": false
  },
   // 文件路径去掉单引号
  "args": ["-Wall","-m32","-g", "${file}", "-o", "${fileDirname}/${fileBasenameNoExtension}.exe"], 
  "problemMatcher": {
    "owner": "cpp",
    "fileLocation": ["relative", "${workspaceRoot}"],
    "pattern": {
      "regexp": "^(.*):(\\d+):(\\d+):\\s+(warning|error):\\s+(.*)$",
      "file": 1,
      "line": 2,
      "column": 3,
      "severity": 4,
      "message": 5
    }
  }
}

灵感来自
https://stackoverflow.com/questions/12518087/g-fatal-error-no-input-files-windows

最后我的系统是windows10

原来单引号也会产生影响……
单引号添加是为了防止路径中出现空格,我会在下个版本修改配置文件并在选择路径时增加空格限制。
感谢分享!

from autovscenv_wpf.

SDchao avatar SDchao commented on September 2, 2024

感谢分享,我查看了配置文件,参数大致相同(只是增加了允许显示警告的参数),唯一区别就是把g++换成了gcc
gcc命令在处理C++语法文件时会出现响应错误,如果你用不到任何C++特性是可行的。
至于这个g++报错而gcc无错误的问题我没有办法复现,暂时还没有办法解决。
感谢分享!

from autovscenv_wpf.

liulinboyi avatar liulinboyi commented on September 2, 2024

你好,今天我也遇到同样的问题,解决方法是

tasks.json文件修改如下

{
  "version": "2.0.0",
  "command": "g++",
  "type": "shell",
  "presentation": {
    "echo": true,
    "reveal": "always",
    "focus": false,
    "panel": "shared",
    "showReuseMessage": true,
    "clear": false
  },
   // 文件路径去掉单引号
  "args": ["-Wall","-m32","-g", "${file}", "-o", "${fileDirname}/${fileBasenameNoExtension}.exe"], 
  "problemMatcher": {
    "owner": "cpp",
    "fileLocation": ["relative", "${workspaceRoot}"],
    "pattern": {
      "regexp": "^(.*):(\\d+):(\\d+):\\s+(warning|error):\\s+(.*)$",
      "file": 1,
      "line": 2,
      "column": 3,
      "severity": 4,
      "message": 5
    }
  }
}

灵感来自
https://stackoverflow.com/questions/12518087/g-fatal-error-no-input-files-windows

最后我的系统是windows10

from autovscenv_wpf.

liulinboyi avatar liulinboyi commented on September 2, 2024

原来存在

g++: error : d:\wcc\test.cpp":Invalid argument
g++: fatal error : no input files
” 的问题,按照B站一留言把 lauch.json里的最后一行 "preLaunchTask": "gcc" 给注释掉了,结果就是:运行通过,但是不能编译,和up主说的一样,没有产生exe文件,没有解决实质问题;
解决方法:
参考:https://www.jianshu.com/p/b7cc0e36cd5f 这个博客里,
对照他的json文件,把up主的json文件修改了一下就可以了,可以编译+运行成功,下面给出修改后的各json文件:

c_cpp_properties.txt
launch.txt
tasks.txt

另外需要注意的是,在运行的时候若有错误,再检查下环境变量里path和include是否正确,修改后电脑重启生效。
再次感谢~

#4 (comment)

from autovscenv_wpf.

liulinboyi avatar liulinboyi commented on September 2, 2024

感谢分享,我查看了配置文件,参数大致相同(只是增加了允许显示警告的参数),唯一区别就是把g++换成了gcc
gcc命令在处理C++语法文件时会出现响应错误,如果你用不到任何C++特性是可行的。
至于这个g++报错而gcc无错误的问题我没有办法复现,暂时还没有办法解决。
感谢分享!

#4 (comment)

from autovscenv_wpf.

liulinboyi avatar liulinboyi commented on September 2, 2024

你好,今天我也遇到同样的问题,解决方法是

tasks.json文件修改如下

{
  "version": "2.0.0",
  "command": "g++",
  "type": "shell",
  "presentation": {
    "echo": true,
    "reveal": "always",
    "focus": false,
    "panel": "shared",
    "showReuseMessage": true,
    "clear": false
  },
   // 文件路径去掉单引号
  "args": ["-Wall","-m32","-g", "${file}", "-o", "${fileDirname}/${fileBasenameNoExtension}.exe"], 
  "problemMatcher": {
    "owner": "cpp",
    "fileLocation": ["relative", "${workspaceRoot}"],
    "pattern": {
      "regexp": "^(.*):(\\d+):(\\d+):\\s+(warning|error):\\s+(.*)$",
      "file": 1,
      "line": 2,
      "column": 3,
      "severity": 4,
      "message": 5
    }
  }
}

灵感来自
https://stackoverflow.com/questions/12518087/g-fatal-error-no-input-files-windows

最后我的系统是windows10

原来单引号也会产生影响……
单引号添加是为了防止路径中出现空格,我会在下个版本修改配置文件并在选择路径时增加空格限制。
感谢分享!

好的,谢谢!如今开发者或者学生学习C语言非常需要现代、轻量、的开发工具(VScode)来调试C语言,感谢你的一键配置VScode的C语言开发环境和你做的工作!

from autovscenv_wpf.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.