How can I solve "Unable to open 'raise.c' " Error?(VSCODE , LINUX)

Hamid Reza picture Hamid Reza · Dec 1, 2019 · Viewed 7.6k times · Source

( OS and Version: Ubuntu 18.4 , VS Code Version: Vscode 1.4 ,C/C++ Extension Version:0.26)

Hello, I have read all the articles about "raise.c" and none of them solved my problem, I just wrote a simple OpenCV code which captures webcam's frames. each time I run my code it frequently shows an error. the error message is:

Unable to open 'raise.c': Unable to read file (Error: File not found (/build/glibc-OTsEL5/glibc-2.27/sysdeps/unix/sysv/linux/raise.c)).

launch.json is:

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "name": "g++ build and debug active file",
            "type": "cppdbg",
            "request": "launch",
            "program": "${fileDirname}/${fileBasenameNoExtension}",
            "args": [],
            "stopAtEntry": false,
            "cwd": "${workspaceFolder}",
            "environment": [],
            "externalConsole": false,
            "MIMode": "gdb",
            "setupCommands": [
                {
                    "description": "Enable pretty-printing for gdb",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": true
                }
            ],
            "preLaunchTask": "g++ build active file",
            "miDebuggerPath": "/usr/bin/gdb"
        }
    ]
}

and tasks.json is:

{
    "tasks": [
        {
            "type": "shell",
            "label": "g++ build active file",
            "command": "/usr/bin/g++",
            "args": [
                "-g",
                "${file}",
                "-o",
                "${fileDirname}/${fileBasenameNoExtension}",
                "`pkg-config",
                 "--libs",
                  "--cflags", 
                  "opencv4`"

            ],
            "options": {
                "cwd": "/usr/bin"
            }
        }
    ],
    "version": "2.0.0"
}

So How can I solve this problem? is there any way to solve it. I am a beginner programmer.

and the second problem is each time I run this code my webcam freezes and I have to use "force quite "bottom. why my webcam freezes? any ideas are welcome. thanks. (I am using ubuntu and my IDE is Vscode )

Answer

Hamid Reza picture Hamid Reza · Dec 3, 2019

Finally, I found the solution after 3 days of working. I am writing a solution for the next generation. There is no need to search on the internet you can't find anything :D

okay if you want to solve the problem you need to reinstall OpenCV again and turn all flags off. it's a bug. the flags which I used for are:

cmake -D BUILD_TIFF=ON -D WITH_CUDA=OFF -D ENABLE_AVX=OFF -D
WITH_OPENGL=ON -D WITH_OPENCL=OFF -D WITH_IPP=OFF -D WITH_TBB=ON -D
BUILD_TBB=ON -D WITH_EIGEN=OFF -D WITH_V4L=OFF -D WITH_VTK=OFF -D 
BUILD_TESTS=OFF -D BUILD_PERF_TESTS=OFF -D CMAKE_BUILD_TYPE=RELEASE -D
CMAKE_INSTALL_PREFIX=/usr/local -D
OPENCV_EXTRA_MODULES_PATH=./../opencv_contrib/modules ..

fill OPENCV_EXTRA_MODULES_PATH and CMAKE_INSTALL_PREFIX=/usr/local with the correct path!

that's all, good luck.