VS Code 的Include Path的问题

在我的VS Code的g++开发环境中设置Include Path遇到的问题以及解决方法。

  • 在Editor环境中include 的文件有红色的波浪线显示include 文件找不到。
  •  Editor的问题解决后,在Build Task时候还是会找不到对应的头文件。
    • 解决方法:一开始以为是c_cpp_properties.json配置错误,Google后发现c_cpp_properties.json解决的仅仅是编辑的波浪线问题,不能解决Build的问题
      • 在.vscode/task.json中追加编译参数就可以了
      • 	"tasks": [
        		{
        			"type": "cppbuild",
        			"label": "C/C++: g++.exe build active file",
        			"command": "C:\\msys64\\mingw64\\bin\\g++.exe",
        			"args": [
        				"-fdiagnostics-color=always",
        				"-g",
        				"${file}",
        				"-o",
        				"${fileDirname}\\${fileBasenameNoExtension}.exe",
        				"--include-directory=../../gui/lvgl"
        			],
        

         

posted @ 2021-10-04 16:56  magicduan  阅读(945)  评论(0编辑  收藏  举报