You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

VSCode中C/C++文件持续报command-line error: invalid number: 2 0000求助

VSCode C/C++扩展报错「command-line error: invalid number: 2 0000」但编译正常的解决办法

我在Windows 10 Pro上用VSCode做C/C开发时遇到了一个异常问题:所有程序编译运行都正常,但C/C扩展包会在每个C/C++文件的开头持续提示错误:command-line error: invalid number: 2 0000。

最初我以为是单台电脑的配置问题,但另一台电脑按完全相同的步骤配置(通过Cygnus的Cygwin安装egcs-2.91.57版本的gcc/g++,系统安装VSCode并安装C/C++扩展包,仅修改右键打开文件夹的设置)后,也出现了完全一样的问题。

我已经尝试过以下操作,但都未能解决问题:

  • 禁用C/C++扩展包
  • 删除扩展相关文件后重装C/C++扩展
  • 重启VSCode
  • 重启电脑
  • 重装VSCode

错误在不同文件中的表现:

  • C++文件:文件开头出现红色波浪线,提示上述错误
  • C文件:同样在文件开头出现相同的错误提示

我的VSCode本地settings.json内容如下:

{"csharp.semanticHighlighting.enabled": false}

扩展文件夹中的settings.nls.metadata.json内容如下:

{"messages": ["Code formatting is using settings from .editorconfig instead of .clang-format. For more information, see the documentation for the 'Default' value of the 'C_Cpp.formatting' setting."],"keys": [{"key": "editorconfig.default.behavior","comment": ["Single-quotes are used here, as this message is displayed in a context that does not render markdown. Do not change them to back-ticks."]}],"filePath": "src\\LanguageServer\\settings"}

请问有没有办法要么修复这个问题的根源,要么单独禁用这个特定错误的波浪线提示?

内容的提问来源于stack exchange,提问作者ObamaRules98

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.25 13:36:38