靓靓靓亮 2022-03-07 16:01 采纳率: 33.3%
浏览 354

vscode编译出现cpp: fatal error: too many input files

在vscode编译时出现cpp: fatal error: too many input files

img

task.json:


{
    "version": "2.0.0",
    "tasks": [
        {
            "label": "catkin_make:debug",
            "type": "shell",
            "command": "catkin_make",
            "args": [],
            "group": "build",
            "presentation": {
                "reveal": "always"
            },
            "problemMatcher": "$msCompile"
        },
        {
            "type": "cppbuild",
            "label": "C/C++: cpp 生成活动文件",
            "command": "/usr/bin/cpp",
            "args": [
                "-fdiagnostics-color=always",
                "-g",
                "${file}",
                "-o",
                "${fileDirname}/${fileBasenameNoExtension}",

                /* 项目所需的头文件路径 */
                //"-I","${workspaceFolder}/",
                "-I","/opt/ros/noetic/include/**",
                "-I","/home/lxl/catkin_ws/src/program_control/include/**",
                "-I","/usr/include/**",
                "-I","/usr/local/include/",
                "-I","/usr/local/include/opencv4/",
                "-I","/usr/local/include/opencv4/opencv2",

                /* 项目所需的库文件路径 */
                "-L", "/usr/local/lib",
 
                /* OpenCV的lib库 */
                "/usr/local/lib/libopencv_*",
            ],
            "options": {
                "cwd": "${fileDirname}"
            },
            "problemMatcher": [
                "$gcc"
            ],
            "group": {
                "kind": "build",
                "isDefault": true
            },
            "detail": "调试器生成的任务。"
        }
    ]
}

img

  • 写回答

3条回答 默认 最新

  • 关注

    可能的原因:
    (1)gcc的配置位置发生变化,或者找不到gcc
    (2)gcc版本较低

    查看gcc是否已经安装,如未安装,则安装gcc。如已安装,把gcc升级到一个较高版本。


    gcc tends to report the error message "cpp: too many input files" when it cannot find tools in the places it expects them to be. One cause is if you configured with a --prefix or a --exec-prefix argument with a trailing slash. You must ensure there are no trailing slashes to the arguments to --prefix and --exec-prefix. Another cause is if you have moved your gcc installation from the location you originally specified when it was configured. This location is determined primarily by the --exec-prefix argument to gcc's configure script.

    More recent gcc snapshots do not have this limitation, which is specific to gcc 2.95.2 or earlier. To resolve it, you can: use a more recent gcc snapshot; reconfigure gcc with the intended installation location set correctly; or set up symlinks from the old location to the new one.

    评论 编辑记录

报告相同问题?

问题事件

  • 创建了问题 3月7日